@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | { |
| 54 | 54 | $className = get_class($entity); |
| 55 | 55 | |
| 56 | - if (! isset($key)) { |
|
| 56 | + if (!isset($key)) { |
|
| 57 | 57 | $key = $className; |
| 58 | 58 | } |
| 59 | 59 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $entityId = $entity->getId(); |
| 64 | 64 | |
| 65 | 65 | // check if entity is not persisted |
| 66 | - if (! $entityId) { |
|
| 66 | + if (!$entityId) { |
|
| 67 | 67 | // persist entity & retrieve its ID |
| 68 | 68 | $this->repositories->getRepository($className)->store($entity); |
| 69 | 69 | $entityId = $entity->getId(); |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | public function getAttachedEntity($key) |
| 83 | 83 | { |
| 84 | - if (! isset($this->references[$key])) { |
|
| 84 | + if (!isset($this->references[$key])) { |
|
| 85 | 85 | return; |
| 86 | 86 | } |
| 87 | 87 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | $entity = $this->repositories->getRepository($reference['repository']) |
| 90 | 90 | ->find($reference['id']); |
| 91 | 91 | |
| 92 | - if (! $entity) { |
|
| 92 | + if (!$entity) { |
|
| 93 | 93 | // remove reference if entity does not exists |
| 94 | 94 | unset($this->references[$key]); |
| 95 | 95 | } |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | { |
| 29 | 29 | use EntityTrait, ClonePropertiesTrait; |
| 30 | 30 | |
| 31 | - private $cloneProperties = [ '!items' ]; |
|
| 31 | + private $cloneProperties = ['!items']; |
|
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * The leafs. |
@@ -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()) { |
@@ -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. |
@@ -78,7 +78,7 @@ |
||
| 78 | 78 | /** |
| 79 | 79 | * @see AttachableEntityInterface::createAttachedEntity() |
| 80 | 80 | */ |
| 81 | - public function createAttachedEntity($entityClass, $values = [], $key=null) |
|
| 81 | + public function createAttachedEntity($entityClass, $values = [], $key = null) |
|
| 82 | 82 | { |
| 83 | 83 | return $this->getAttachableEntityManager()->createAttachedEntity($entityClass, $values, $key); |
| 84 | 84 | } |
@@ -69,7 +69,7 @@ |
||
| 69 | 69 | ? [ |
| 70 | 70 | 'type' => $coords->getType(), |
| 71 | 71 | 'coordinates' => $coords->getCoordinates(), |
| 72 | - ] |
|
| 72 | + ] |
|
| 73 | 73 | : null |
| 74 | 74 | |
| 75 | 75 | ]; |
@@ -96,23 +96,23 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | if ($number) { |
| 99 | - $str .= ' ' . $number . ', '; |
|
| 99 | + $str .= ' '.$number.', '; |
|
| 100 | 100 | } |
| 101 | 101 | if ($postalCode) { |
| 102 | - $str .= $postalCode . ' '; |
|
| 102 | + $str .= $postalCode.' '; |
|
| 103 | 103 | } |
| 104 | 104 | if ($city) { |
| 105 | 105 | $str .= $city; |
| 106 | 106 | } |
| 107 | 107 | if ($region) { |
| 108 | - $str .= ', ' . $region; |
|
| 108 | + $str .= ', '.$region; |
|
| 109 | 109 | } |
| 110 | 110 | if ($country) { |
| 111 | - $str .= ', ' . $country; |
|
| 111 | + $str .= ', '.$country; |
|
| 112 | 112 | } |
| 113 | 113 | if ($coords) { |
| 114 | 114 | $coords = $coords->getCoordinates(); |
| 115 | - $str .= ' ( ' . join(', ', $coords) . ' )'; |
|
| 115 | + $str .= ' ( '.join(', ', $coords).' )'; |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | return $str; |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | if ('coordinates' == $key) { |
| 157 | - $class = '\\Geo\\Entity\\Geometry\\' . $value['type']; |
|
| 157 | + $class = '\\Geo\\Entity\\Geometry\\'.$value['type']; |
|
| 158 | 158 | $value = new $class($value['coordinates']); |
| 159 | 159 | } |
| 160 | 160 | |
@@ -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 | } |
@@ -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 | /** |
@@ -14,12 +14,12 @@ |
||
| 14 | 14 | interface AddressInterface extends EntityInterface |
| 15 | 15 | { |
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * Postal Code of the Address. |
|
| 19 | - * |
|
| 20 | - * @param string $postalCode |
|
| 21 | - * @return AddressInterface |
|
| 22 | - */ |
|
| 17 | + /** |
|
| 18 | + * Postal Code of the Address. |
|
| 19 | + * |
|
| 20 | + * @param string $postalCode |
|
| 21 | + * @return AddressInterface |
|
| 22 | + */ |
|
| 23 | 23 | public function setPostalCode($postalCode); |
| 24 | 24 | public function getPostalCode(); |
| 25 | 25 | |