Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
72.22% |
13 / 18 |
|
75.00% |
3 / 4 |
CRAP | |
0.00% |
0 / 1 |
| Topic | |
72.22% |
13 / 18 |
|
75.00% |
3 / 4 |
9.37 | |
0.00% |
0 / 1 |
| parseData | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
2 | |||
| fetchList | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
2 | |||
| fetchPath | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
3 | |||
| readSearchResultList | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * @package 115Mandant |
| 5 | * @copyright BerlinOnline Stadtportal GmbH & Co. KG |
| 6 | **/ |
| 7 | |
| 8 | namespace BO\Zmsdldb\File; |
| 9 | |
| 10 | use BO\Zmsdldb\Entity\Topic as Entity; |
| 11 | use BO\Zmsdldb\Collection\Topics as Collection; |
| 12 | |
| 13 | /** |
| 14 | * Common methods shared by access classes |
| 15 | */ |
| 16 | class Topic extends Base |
| 17 | { |
| 18 | protected function parseData($data) |
| 19 | { |
| 20 | $itemList = new Collection(); |
| 21 | foreach ($data['data'] as $item) { |
| 22 | $itemList[$item['id']] = new Entity($item); |
| 23 | } |
| 24 | return $itemList; |
| 25 | } |
| 26 | |
| 27 | /** |
| 28 | * |
| 29 | * @return Collection |
| 30 | */ |
| 31 | public function fetchList() |
| 32 | { |
| 33 | $topiclist = new Collection(); |
| 34 | foreach ($this->getItemList() as $item) { |
| 35 | $topiclist[$item['id']] = $item; |
| 36 | } |
| 37 | return $topiclist; |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * |
| 42 | * @return Entity |
| 43 | */ |
| 44 | public function fetchPath($topic_path) |
| 45 | { |
| 46 | $topiclist = $this->fetchList(); |
| 47 | foreach ($topiclist as $topic) { |
| 48 | if ($topic['path'] == $topic_path) { |
| 49 | return $topic; |
| 50 | } |
| 51 | } |
| 52 | return false; |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * @return Entity |
| 57 | */ |
| 58 | public function readSearchResultList($querystring) |
| 59 | { |
| 60 | $topic = new Entity(); |
| 61 | $topic['relation']['locations'] = $this->access()->fromLocation()->readSearchResultList($querystring); |
| 62 | $topic['relation']['services'] = $this->access()->fromService()->readSearchResultList($querystring); |
| 63 | $topic['links'] = $this->access()->fromLink()->readSearchResultList($querystring); |
| 64 | return $topic; |
| 65 | } |
| 66 | } |