@@ -22,6 +22,9 @@ |
||
22 | 22 | */ |
23 | 23 | trait EntityTrait |
24 | 24 | { |
25 | + /** |
|
26 | + * @param string $property |
|
27 | + */ |
|
25 | 28 | public function notEmpty($property, array $args=[]) |
26 | 29 | { |
27 | 30 | $method = "get$property"; |
@@ -20,16 +20,16 @@ |
||
20 | 20 | */ |
21 | 21 | trait EntityTrait |
22 | 22 | { |
23 | - public function notEmpty($property, array $args=[]) |
|
23 | + public function notEmpty($property, array $args = []) |
|
24 | 24 | { |
25 | 25 | $method = "get$property"; |
26 | 26 | |
27 | 27 | if (!method_exists($this, $method)) { |
28 | - throw new OutOfBoundsException("'$property' is not a valid property of '" . get_class($this) . "'"); |
|
28 | + throw new OutOfBoundsException("'$property' is not a valid property of '".get_class($this)."'"); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | $value = count($args) |
32 | - ? call_user_func_array([ $this, $method ], $args) |
|
32 | + ? call_user_func_array([$this, $method], $args) |
|
33 | 33 | : $this->$method(); |
34 | 34 | |
35 | 35 | if (null === $value) { // is_scalar does not consider 'null' to be scalar value. |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | /** |
130 | 130 | * Gets the name of a file |
131 | 131 | * |
132 | - * @return mixed |
|
132 | + * @return string |
|
133 | 133 | */ |
134 | 134 | public function getName() |
135 | 135 | { |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | /** |
198 | 198 | * Gets the uploaded date of a file |
199 | 199 | * |
200 | - * @return mixed |
|
200 | + * @return null|\DateTime |
|
201 | 201 | */ |
202 | 202 | public function getDateUploaded() |
203 | 203 | { |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | /** |
234 | 234 | * Gets the length of the file |
235 | 235 | * |
236 | - * @return mixed |
|
236 | + * @return string|null |
|
237 | 237 | */ |
238 | 238 | public function getLength() |
239 | 239 | { |
@@ -146,18 +146,18 @@ |
||
146 | 146 | $size = $this->getLength(); |
147 | 147 | |
148 | 148 | if ($size >= 1073741824) { |
149 | - return round($size / 1073741824, 2) . ' GB'; |
|
149 | + return round($size / 1073741824, 2).' GB'; |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | if ($size >= 1048576) { |
153 | - return round($size / 1048576, 2) . ' MB'; |
|
153 | + return round($size / 1048576, 2).' MB'; |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | if ($size >= 1024) { |
157 | - return round($size / 1024, 2) . ' kB'; |
|
157 | + return round($size / 1024, 2).' kB'; |
|
158 | 158 | } |
159 | 159 | |
160 | - return (string)$size; |
|
160 | + return (string) $size; |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | /** |
@@ -89,7 +89,7 @@ |
||
89 | 89 | /** |
90 | 90 | * exclude methods from the automatism |
91 | 91 | * |
92 | - * @param $methods |
|
92 | + * @param string[] $methods |
|
93 | 93 | */ |
94 | 94 | public function setExcludeMethods($methods) |
95 | 95 | { |
@@ -32,9 +32,9 @@ discard block |
||
32 | 32 | |
33 | 33 | $getters = array_filter( |
34 | 34 | get_class_methods($object), |
35 | - function ($methodName) use ($object) { |
|
35 | + function($methodName) use ($object) { |
|
36 | 36 | return "get" === substr($methodName, 0, 3) |
37 | - && method_exists($object, 's' . substr($methodName, 1)); |
|
37 | + && method_exists($object, 's'.substr($methodName, 1)); |
|
38 | 38 | } |
39 | 39 | ); |
40 | 40 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | } |
62 | 62 | $setters = array_filter( |
63 | 63 | get_class_methods($object), |
64 | - function ($methodName) { |
|
64 | + function($methodName) { |
|
65 | 65 | return "set" === substr($methodName, 0, 3); |
66 | 66 | } |
67 | 67 | ); |
@@ -59,7 +59,7 @@ |
||
59 | 59 | * @param array $images |
60 | 60 | * @param PermissionsInterface $permissions |
61 | 61 | * |
62 | - * @return mixed |
|
62 | + * @return ImageSet |
|
63 | 63 | */ |
64 | 64 | public function setImages(array $images, PermissionsInterface $permissions = null); |
65 | 65 |
@@ -20,14 +20,14 @@ discard block |
||
20 | 20 | * Sets the Postal Code of a location |
21 | 21 | * |
22 | 22 | * @param string $postalCode |
23 | - * @return mixed |
|
23 | + * @return AbstractLocation |
|
24 | 24 | */ |
25 | 25 | public function setPostalCode($postalCode); |
26 | 26 | |
27 | 27 | /** |
28 | 28 | * Gets the Postal Code of a location |
29 | 29 | * |
30 | - * @return mixed |
|
30 | + * @return string |
|
31 | 31 | */ |
32 | 32 | public function getPostalCode(); |
33 | 33 | |
@@ -44,6 +44,7 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @param GeoJson $coordinates |
46 | 46 | * @internal param $point |
47 | + * @return AbstractLocation |
|
47 | 48 | */ |
48 | 49 | public function setCoordinates(GeoJson $coordinates); |
49 | 50 | |
@@ -51,7 +52,7 @@ discard block |
||
51 | 52 | * Sets the city name of a Location |
52 | 53 | * |
53 | 54 | * @param $city |
54 | - * @return mixed |
|
55 | + * @return AbstractLocation |
|
55 | 56 | */ |
56 | 57 | public function setCity($city); |
57 | 58 | |
@@ -66,14 +67,14 @@ discard block |
||
66 | 67 | * Sets the country of a location |
67 | 68 | * |
68 | 69 | * @param $country |
69 | - * @return mixed |
|
70 | + * @return AbstractLocation |
|
70 | 71 | */ |
71 | 72 | public function setCountry($country); |
72 | 73 | |
73 | 74 | /** |
74 | 75 | * Gets the country of a location |
75 | 76 | * |
76 | - * @return mixed |
|
77 | + * @return string |
|
77 | 78 | */ |
78 | 79 | public function getCountry(); |
79 | 80 | |
@@ -81,7 +82,7 @@ discard block |
||
81 | 82 | * Sets the region of a location. Eg. "Hessen" is a region in "Germany" |
82 | 83 | * |
83 | 84 | * @param $region |
84 | - * @return mixed |
|
85 | + * @return AbstractLocation |
|
85 | 86 | */ |
86 | 87 | public function setRegion($region); |
87 | 88 | |
@@ -96,14 +97,14 @@ discard block |
||
96 | 97 | * Sets the Streetname of a location |
97 | 98 | * |
98 | 99 | * @param $street |
99 | - * @return mixed |
|
100 | + * @return AbstractLocation |
|
100 | 101 | */ |
101 | 102 | public function setStreetname($street); |
102 | 103 | |
103 | 104 | /** |
104 | 105 | * Gets the streetname of a location |
105 | 106 | * |
106 | - * @return mixed |
|
107 | + * @return string |
|
107 | 108 | */ |
108 | 109 | public function getStreetname(); |
109 | 110 | |
@@ -111,14 +112,14 @@ discard block |
||
111 | 112 | * Sets the Streetnumber of a location |
112 | 113 | * |
113 | 114 | * @param $number |
114 | - * @return mixed |
|
115 | + * @return AbstractLocation |
|
115 | 116 | */ |
116 | 117 | public function setStreetnumber($number); |
117 | 118 | |
118 | 119 | /** |
119 | 120 | * Gets the streetnumber of a location |
120 | 121 | * |
121 | - * @return mixeed |
|
122 | + * @return string |
|
122 | 123 | */ |
123 | 124 | public function getStreetnumber(); |
124 | 125 | } |
@@ -353,6 +353,9 @@ |
||
353 | 353 | return $this; |
354 | 354 | } |
355 | 355 | |
356 | + /** |
|
357 | + * @param string $permission |
|
358 | + */ |
|
356 | 359 | private function checkIsGranted($userId, $permission) |
357 | 360 | { |
358 | 361 | if (!$userId) { |
@@ -149,21 +149,21 @@ discard block |
||
149 | 149 | } |
150 | 150 | |
151 | 151 | if (preg_match('~^is(View|Change|None|All)Granted$~', $method, $match)) { |
152 | - $permission = constant('self::PERMISSION_' . strtoupper($match[1])); |
|
152 | + $permission = constant('self::PERMISSION_'.strtoupper($match[1])); |
|
153 | 153 | return $this->isGranted($params[0], $permission); |
154 | 154 | } |
155 | 155 | |
156 | 156 | if (preg_match('~^grant(View|Change|None|All)$~', $method, $match)) { |
157 | - $permission = constant('self::PERMISSION_' . strtoupper($match[1])); |
|
157 | + $permission = constant('self::PERMISSION_'.strtoupper($match[1])); |
|
158 | 158 | return $this->grant($params[0], $permission); |
159 | 159 | } |
160 | 160 | |
161 | 161 | if (preg_match('~^revoke(View|Change|None|All)$~', $method, $match)) { |
162 | - $permission = constant('self::PERMISSION_' . strtoupper($match[1])); |
|
162 | + $permission = constant('self::PERMISSION_'.strtoupper($match[1])); |
|
163 | 163 | return $this->revoke($params[0], $permission); |
164 | 164 | } |
165 | 165 | |
166 | - throw new \BadMethodCallException('Unknown method "' . $method . '"'); |
|
166 | + throw new \BadMethodCallException('Unknown method "'.$method.'"'); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | /** |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | if ($build) { |
312 | 312 | $this->build(); |
313 | 313 | } |
314 | - $this->hasChanged= true; |
|
314 | + $this->hasChanged = true; |
|
315 | 315 | |
316 | 316 | // restore orginial permissions type |
317 | 317 | $this->type = $oldType; |
@@ -444,10 +444,10 @@ discard block |
||
444 | 444 | } |
445 | 445 | |
446 | 446 | if ($resource instanceof UserInterface) { |
447 | - return 'user:' . $resource->getId(); |
|
447 | + return 'user:'.$resource->getId(); |
|
448 | 448 | } |
449 | 449 | |
450 | - return 'user:' . $resource; |
|
450 | + return 'user:'.$resource; |
|
451 | 451 | } |
452 | 452 | |
453 | 453 | /** |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | ); |
468 | 468 | if (!in_array($permission, $perms)) { |
469 | 469 | throw new \InvalidArgumentException( |
470 | - 'Invalid permission. Must be one of ' . implode(', ', $perms) |
|
470 | + 'Invalid permission. Must be one of '.implode(', ', $perms) |
|
471 | 471 | ); |
472 | 472 | } |
473 | 473 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | { |
24 | 24 | /** |
25 | 25 | * @param $data |
26 | - * @return mixed |
|
26 | + * @return Snapshot |
|
27 | 27 | * @ODM\PreUpdate |
28 | 28 | */ |
29 | 29 | public function __invoke($data) |
@@ -77,6 +77,9 @@ discard block |
||
77 | 77 | return $return === $entity ? $this : $return; |
78 | 78 | } |
79 | 79 | |
80 | + /** |
|
81 | + * @param string $method |
|
82 | + */ |
|
80 | 83 | protected function proxyClone($method, ...$args) |
81 | 84 | { |
82 | 85 | $value = $this->proxy($method, ...$args); |
@@ -85,6 +88,9 @@ discard block |
||
85 | 88 | return $return; |
86 | 89 | } |
87 | 90 | |
91 | + /** |
|
92 | + * @param string $property |
|
93 | + */ |
|
88 | 94 | protected function inaccessible($property) |
89 | 95 | { |
90 | 96 | throw new \DomainException(sprintf( |
@@ -93,6 +99,9 @@ discard block |
||
93 | 99 | )); |
94 | 100 | } |
95 | 101 | |
102 | + /** |
|
103 | + * @param string $property |
|
104 | + */ |
|
96 | 105 | protected function immutable($property) |
97 | 106 | { |
98 | 107 | throw new ImmutablePropertyException($property, $this); |
@@ -72,7 +72,7 @@ |
||
72 | 72 | if (!is_callable($callback)) { |
73 | 73 | throw new \BadMethodCallException(sprintf( |
74 | 74 | 'Proxy error: Method "%s" does not exist in proxied "%s"', |
75 | - $method, |
|
75 | + $method, |
|
76 | 76 | get_class($entity) |
77 | 77 | )); |
78 | 78 | } |
@@ -37,7 +37,7 @@ |
||
37 | 37 | : SnapshotMeta::class; |
38 | 38 | |
39 | 39 | $this->snapshotMeta = new $snapshotMetaClass(); |
40 | - $this->snapshotEntity = $source; |
|
40 | + $this->snapshotEntity = $source; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | public function getOriginalEntity() |
@@ -69,6 +69,9 @@ |
||
69 | 69 | */ |
70 | 70 | protected $parent; |
71 | 71 | |
72 | + /** |
|
73 | + * @param string $value |
|
74 | + */ |
|
72 | 75 | final public static function filterValue($value) |
73 | 76 | { |
74 | 77 | $value = mb_strtolower($value); |
@@ -153,7 +153,7 @@ |
||
153 | 153 | |
154 | 154 | public function getValueWithParents($withRoot = false, $useNames = false) |
155 | 155 | { |
156 | - $parts = [ ($useNames ? $this->getName() : $this->getValue()) ]; |
|
156 | + $parts = [($useNames ? $this->getName() : $this->getValue())]; |
|
157 | 157 | $item = $this; |
158 | 158 | |
159 | 159 | while ($item = $item->getParent()) { |