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