Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
31 / 31 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
| ProcessFinishedHelper | |
100.00% |
31 / 31 |
|
100.00% |
3 / 3 |
10 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
1 | |||
| setPickupData | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
3 | |||
| setRequestData | |
100.00% |
19 / 19 |
|
100.00% |
1 / 1 |
6 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * |
| 5 | * @copyright BerlinOnline Stadtportal GmbH & Co. KG |
| 6 | * |
| 7 | */ |
| 8 | |
| 9 | namespace BO\Zmsadmin\Helper; |
| 10 | |
| 11 | class ProcessFinishedHelper extends \BO\Zmsentities\Process |
| 12 | { |
| 13 | public function __construct($processData, $input, $requestList, $source) |
| 14 | { |
| 15 | parent::__construct($processData); |
| 16 | $this->getFirstClient()->addData($input['process']['clients'][0]); |
| 17 | $this->setPickupData($input); |
| 18 | $this->setRequestData($input, $requestList, $source); |
| 19 | $this->setClientsCount($input['statistic']['clientsCount']); |
| 20 | } |
| 21 | |
| 22 | public function setPickupData(array $input) |
| 23 | { |
| 24 | if (array_key_exists('pickupScope', $input) && 0 != $input['pickupScope']) { |
| 25 | $this->status = 'pending'; |
| 26 | $this->scope['id'] = $input['pickupScope']; |
| 27 | $this->clients[0]['emailSendCount'] = "-1"; |
| 28 | $this->clients[0]['notificationsSendCount'] = "-1"; |
| 29 | $this->queue->callCount = 0; |
| 30 | } |
| 31 | return $this; |
| 32 | } |
| 33 | |
| 34 | public function setRequestData( |
| 35 | array $input, |
| 36 | \BO\Zmsentities\Collection\RequestList $requestList, |
| 37 | $source |
| 38 | ) { |
| 39 | if (array_key_exists('ignoreRequests', $input) && $input['ignoreRequests']) { |
| 40 | $this->requests = new \BO\Zmsentities\Collection\RequestList(); |
| 41 | $request = new \BO\Zmsentities\Request([ |
| 42 | 'id' => -1, |
| 43 | 'source' => $source, |
| 44 | 'name' => "Ohne Erfassung", |
| 45 | ]); |
| 46 | $this->requests[] = $request; |
| 47 | } elseif (array_key_exists('noRequestsPerformed', $input) && $input['noRequestsPerformed']) { |
| 48 | $this->requests = new \BO\Zmsentities\Collection\RequestList(); |
| 49 | $request = new \BO\Zmsentities\Request([ |
| 50 | 'id' => 0, |
| 51 | 'source' => $source, |
| 52 | 'name' => "Dienstleistung konnte nicht erbracht werden", |
| 53 | ]); |
| 54 | $this->requests[] = $request; |
| 55 | } elseif (array_key_exists('requestCountList', $input)) { |
| 56 | $this->requests = $requestList->withCountList($input['requestCountList']); |
| 57 | } |
| 58 | return $this; |
| 59 | } |
| 60 | } |