@@ -14,14 +14,14 @@ discard block |
||
14 | 14 | |
15 | 15 | /** |
16 | 16 | * @param callable $callback |
17 | - * @param array|null $optionalArguments |
|
17 | + * @param string[] $optionalArguments |
|
18 | 18 | * @return static |
19 | 19 | */ |
20 | 20 | abstract public function find(callable $callback, array $optionalArguments = null); |
21 | 21 | |
22 | 22 | /** |
23 | 23 | * @param callable $callback |
24 | - * @param array|null $optionalArguments |
|
24 | + * @param string[] $optionalArguments |
|
25 | 25 | * @return static |
26 | 26 | */ |
27 | 27 | abstract public function filter(callable $callback, array $optionalArguments = null); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | /** |
36 | 36 | * @param string $className |
37 | 37 | * |
38 | - * @return mixed |
|
38 | + * @return ObjectCollectionTrait |
|
39 | 39 | */ |
40 | 40 | public function findByType($className) |
41 | 41 | { |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @param string $propertyName |
69 | 69 | * @param $value |
70 | 70 | * @param bool $useGetters |
71 | - * @return mixed |
|
71 | + * @return ObjectCollectionTrait |
|
72 | 72 | */ |
73 | 73 | public function findByProperty($propertyName, $value, $useGetters = false) |
74 | 74 | { |
@@ -94,6 +94,10 @@ discard block |
||
94 | 94 | }); |
95 | 95 | } |
96 | 96 | |
97 | + /** |
|
98 | + * @param string $propertyName |
|
99 | + * @param boolean $useGetters |
|
100 | + */ |
|
97 | 101 | private function getPropertyComparator($propertyName, $value, $useGetters) |
98 | 102 | { |
99 | 103 | if ($useGetters) { |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | public function sortByProperty($propertyName) |
85 | 85 | { |
86 | 86 | |
87 | - return $this->sort(function ($itemA, $itemB) use ($propertyName) { |
|
87 | + return $this->sort(function($itemA, $itemB) use ($propertyName) { |
|
88 | 88 | $a = mp\getValue($itemA, $propertyName, 0); |
89 | 89 | $b = mp\getValue($itemB, $propertyName, 0); |
90 | 90 | if ($a < $b) { |
@@ -97,12 +97,12 @@ discard block |
||
97 | 97 | private function getPropertyComparator($propertyName, $value, $useGetters) |
98 | 98 | { |
99 | 99 | if ($useGetters) { |
100 | - return function ($item) use ($propertyName, $value) { |
|
100 | + return function($item) use ($propertyName, $value) { |
|
101 | 101 | // NAN used as default because NAN !== NAN |
102 | 102 | return mp\getValue($item, $propertyName, NAN) === $value; |
103 | 103 | }; |
104 | 104 | } else { |
105 | - return function ($item) use ($propertyName, $value) { |
|
105 | + return function($item) use ($propertyName, $value) { |
|
106 | 106 | return isset($item->{$propertyName}) && $item->{$propertyName} === $value; |
107 | 107 | }; |
108 | 108 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | public function indexByProperty($propertyName) |
119 | 119 | { |
120 | 120 | $results = []; |
121 | - foreach($this as $item) { |
|
121 | + foreach ($this as $item) { |
|
122 | 122 | $key = mp\getValue($item, $propertyName); |
123 | 123 | if ($key) { |
124 | 124 | $results[$key] = $item; |