Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 15 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 1 |
| Office | |
0.00% |
0 / 15 |
|
0.00% |
0 / 5 |
72 | |
0.00% |
0 / 1 |
| parseData | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getItemList | |
0.00% |
0 / 10 |
|
0.00% |
0 / 1 |
20 | |||
| fetchList | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| fetchId | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| fetchPath | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * @package ClientDldb |
| 5 | * @copyright BerlinOnline Stadtportal GmbH & Co. KG |
| 6 | **/ |
| 7 | |
| 8 | namespace BO\Zmsdldb\MySQL; |
| 9 | |
| 10 | use BO\Zmsdldb\MySQL\Entity\Office as Entity; |
| 11 | use BO\Zmsdldb\MySQL\Collection\Offices as Collection; |
| 12 | use BO\Zmsdldb\Elastic\Office as Base; |
| 13 | |
| 14 | /** |
| 15 | * |
| 16 | */ |
| 17 | class Office extends Base |
| 18 | { |
| 19 | protected static $officeList = []; |
| 20 | |
| 21 | protected function parseData($data) |
| 22 | { |
| 23 | return $this->getItemList(); |
| 24 | } |
| 25 | |
| 26 | public function getItemList() |
| 27 | { |
| 28 | try { |
| 29 | if (empty(static::$officeList)) { |
| 30 | $officeListJson = $this->access()->fromSetting()->fetchName('office'); |
| 31 | $officeList = json_decode($officeListJson, true); |
| 32 | |
| 33 | static::$officeList = new Collection(); |
| 34 | foreach ($officeList as $item) { |
| 35 | static::$officeList[$item['path']] = new Entity($item); |
| 36 | static::$officeList[$item['plural']] = static::$officeList[$item['path']]; |
| 37 | } |
| 38 | #echo '<pre>' . htmlspecialchars(print_r((static::$officeList),1)) . '</pre>';exit; |
| 39 | } |
| 40 | return static::$officeList; |
| 41 | } catch (\Exception $e) { |
| 42 | throw $e; |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | public function fetchList() |
| 47 | { |
| 48 | return $this->getItemList(); |
| 49 | } |
| 50 | |
| 51 | public function fetchId($itemId) |
| 52 | { |
| 53 | $list = $this->fetchList(); |
| 54 | return $list[$itemId] ?? false; |
| 55 | } |
| 56 | |
| 57 | public function fetchPath($itemId) |
| 58 | { |
| 59 | return $this->fetchId($itemId); |
| 60 | } |
| 61 | } |