Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
27 / 27 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
| EntryFromOldRoute | |
100.00% |
27 / 27 |
|
100.00% |
3 / 3 |
11 | |
100.00% |
1 / 1 |
| getScopes | |
100.00% |
11 / 11 |
|
100.00% |
1 / 1 |
5 | |||
| getClusters | |
100.00% |
11 / 11 |
|
100.00% |
1 / 1 |
5 | |||
| getFromOldMehrfachKiosk | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * |
| 5 | * @package Zmsticketprinter |
| 6 | * @copyright BerlinOnline Stadtportal GmbH & Co. KG |
| 7 | * |
| 8 | */ |
| 9 | |
| 10 | namespace BO\Zmsticketprinter\Helper; |
| 11 | |
| 12 | use BO\Mellon\Validator; |
| 13 | |
| 14 | class EntryFromOldRoute |
| 15 | { |
| 16 | protected static function getScopes($request) |
| 17 | { |
| 18 | $scopes = [ ]; |
| 19 | $validator = $request->getAttribute('validator'); |
| 20 | $scopeData = $validator->getParameter('auswahlstandortid') |
| 21 | ->isArray() |
| 22 | ->getValue(); |
| 23 | if ($scopeData) { |
| 24 | foreach ($scopeData as $scope) { |
| 25 | $scope = Validator::value($scope)->isNumber(); |
| 26 | if (! $scope->hasFailed()) { |
| 27 | $scopes[] = 's' . $scope->getValue(); |
| 28 | } |
| 29 | } |
| 30 | } |
| 31 | return (0 < count($scopes)) ? implode(',', $scopes) : null; |
| 32 | } |
| 33 | |
| 34 | protected static function getClusters($request) |
| 35 | { |
| 36 | $clusters = [ ]; |
| 37 | $validator = $request->getAttribute('validator'); |
| 38 | $clusterData = $validator->getParameter('auswahlclusterid') |
| 39 | ->isArray() |
| 40 | ->getValue(); |
| 41 | if ($clusterData) { |
| 42 | foreach ($clusterData as $cluster) { |
| 43 | $cluster = Validator::value($cluster)->isNumber(); |
| 44 | if (! $cluster->hasFailed()) { |
| 45 | $clusters[] = 'c' . $cluster->getValue(); |
| 46 | } |
| 47 | } |
| 48 | } |
| 49 | return (0 < count($clusters)) ? implode(',', $clusters) : null; |
| 50 | } |
| 51 | |
| 52 | public static function getFromOldMehrfachKiosk($request) |
| 53 | { |
| 54 | $buttonList = ''; |
| 55 | $scopes = self::getScopes($request); |
| 56 | $clusters = self::getClusters($request); |
| 57 | $buttonList = implode(',', array_filter(array($scopes, $clusters))); |
| 58 | return $buttonList; |
| 59 | } |
| 60 | } |