Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 22 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 1 |
SearchResults | |
0.00% |
0 / 22 |
|
0.00% |
0 / 4 |
156 | |
0.00% |
0 / 1 |
getNames | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
6 | |||
toSearchResultData | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
20 | |||
addSearchResultsData | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
6 | |||
sortByType | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
20 |
1 | <?php |
2 | |
3 | /** |
4 | * @package Zmsdldb |
5 | * @copyright BerlinOnline Stadtportal GmbH & Co. KG |
6 | **/ |
7 | |
8 | namespace BO\Zmsdldb\Collection; |
9 | |
10 | use BO\Zmsdldb\Entity\SearchResult as Entity; |
11 | |
12 | class SearchResults extends Base |
13 | { |
14 | public function getNames() |
15 | { |
16 | $nameList = array(); |
17 | foreach ($this as $item) { |
18 | $nameList[$item->getId()] = $item->getName(); |
19 | } |
20 | return $nameList; |
21 | } |
22 | |
23 | public function toSearchResultData() |
24 | { |
25 | $list = new self(); |
26 | foreach ($this as $results) { |
27 | foreach ($results as $data) { |
28 | if (count($data)) { |
29 | $item = Entity::create($data); |
30 | $list[] = $item; |
31 | } |
32 | } |
33 | $list; |
34 | } |
35 | return $list; |
36 | } |
37 | |
38 | public function addSearchResultsData($data) |
39 | { |
40 | if ($data) { |
41 | $this[] = $data; |
42 | return $this; |
43 | } |
44 | return null; |
45 | } |
46 | |
47 | public function sortByType(array $order) |
48 | { |
49 | $list = new self(); |
50 | foreach ($order as $type) { |
51 | foreach ($this as $item) { |
52 | if ($item->getType() == $type) { |
53 | $list[] = $item; |
54 | } |
55 | } |
56 | } |
57 | return $list; |
58 | } |
59 | } |