Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
18.18% |
4 / 22 |
|
25.00% |
1 / 4 |
CRAP | |
0.00% |
0 / 1 |
| Topic | |
18.18% |
4 / 22 |
|
25.00% |
1 / 4 |
90.87 | |
0.00% |
0 / 1 |
| getServiceIds | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
2 | |||
| isLinked | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
6 | |||
| getServiceLocationLinkList | |
0.00% |
0 / 10 |
|
0.00% |
0 / 1 |
12 | |||
| getParentId | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
30 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * @package Zmsdldb |
| 5 | * @copyright BerlinOnline Stadtportal GmbH & Co. KG |
| 6 | **/ |
| 7 | |
| 8 | namespace BO\Zmsdldb\Entity; |
| 9 | |
| 10 | /** |
| 11 | * Helper for topics export |
| 12 | */ |
| 13 | class Topic extends Base |
| 14 | { |
| 15 | public function getServiceIds() |
| 16 | { |
| 17 | $serviceIds = array(); |
| 18 | foreach ($this['relation']['services'] as $service) { |
| 19 | $serviceIds[] = $service['id']; |
| 20 | } |
| 21 | return $serviceIds; |
| 22 | } |
| 23 | |
| 24 | public function isLinked() |
| 25 | { |
| 26 | return ($this['relation']['navi'] || static::subcount($this['relation']['navi'])); |
| 27 | } |
| 28 | |
| 29 | public function getServiceLocationLinkList() |
| 30 | { |
| 31 | $list = new \BO\Zmsdldb\Collection\Base(); |
| 32 | $items = array( |
| 33 | $this['relation']['services'], |
| 34 | $this['relation']['locations'], |
| 35 | $this['links'] |
| 36 | ); |
| 37 | foreach ($items as $item) { |
| 38 | foreach ($item as $entity) { |
| 39 | $list[] = $entity; |
| 40 | } |
| 41 | } |
| 42 | return $list; |
| 43 | } |
| 44 | |
| 45 | public function getParentId() |
| 46 | { |
| 47 | if (count($this['relation']['parents']) > 1) { |
| 48 | foreach ($this['relation']['parents'] as $item) { |
| 49 | if ($item['path'] == $this['path']) { |
| 50 | return $item['id']; |
| 51 | } |
| 52 | } |
| 53 | } elseif (count($this['relation']['parents']) == 1) { |
| 54 | return $this['relation']['parents'][0]['id']; |
| 55 | } |
| 56 | return $this['id']; |
| 57 | } |
| 58 | } |