Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
23 / 23 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| ProcessFinishedHelper | |
100.00% |
23 / 23 |
|
100.00% |
2 / 2 |
7 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
| 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 | use BO\Zmsentities\Process; |
| 12 | use BO\Zmsentities\Collection\RequestList; |
| 13 | use BO\Zmsentities\Request; |
| 14 | |
| 15 | class ProcessFinishedHelper extends Process |
| 16 | { |
| 17 | public function __construct($processData, $input, $requestList, $source) |
| 18 | { |
| 19 | parent::__construct($processData); |
| 20 | $this->getFirstClient()->addData($input['process']['clients'][0]); |
| 21 | $this->setRequestData($input, $requestList, $source); |
| 22 | $this->setClientsCount($input['statistic']['clientsCount']); |
| 23 | } |
| 24 | |
| 25 | public function setRequestData( |
| 26 | array $input, |
| 27 | RequestList $requestList, |
| 28 | $source |
| 29 | ) { |
| 30 | if (array_key_exists('ignoreRequests', $input) && $input['ignoreRequests']) { |
| 31 | $this->requests = new RequestList(); |
| 32 | $request = new Request([ |
| 33 | 'id' => -1, |
| 34 | 'source' => $source, |
| 35 | 'name' => "Ohne Erfassung", |
| 36 | ]); |
| 37 | $this->requests[] = $request; |
| 38 | } elseif (array_key_exists('noRequestsPerformed', $input) && $input['noRequestsPerformed']) { |
| 39 | $this->requests = new RequestList(); |
| 40 | $request = new Request([ |
| 41 | 'id' => 0, |
| 42 | 'source' => $source, |
| 43 | 'name' => "Dienstleistung konnte nicht erbracht werden", |
| 44 | ]); |
| 45 | $this->requests[] = $request; |
| 46 | } elseif (array_key_exists('requestCountList', $input)) { |
| 47 | $this->requests = $requestList->withCountList($input['requestCountList']); |
| 48 | } |
| 49 | return $this; |
| 50 | } |
| 51 | } |