@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | /** |
| 15 | 15 | * @param array $data |
| 16 | 16 | */ |
| 17 | - public function __construct(array $data = []) |
|
| 17 | + public function __construct(array $data = [ ]) |
|
| 18 | 18 | { |
| 19 | 19 | $this->populate($data); |
| 20 | 20 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * @param array $properties |
| 32 | 32 | * @return array |
| 33 | 33 | */ |
| 34 | - public function extract(array $properties = []) |
|
| 34 | + public function extract(array $properties = [ ]) |
|
| 35 | 35 | { |
| 36 | 36 | $state = get_object_vars($this); |
| 37 | 37 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * @param array $array |
| 49 | 49 | * @return $this |
| 50 | 50 | */ |
| 51 | - public function populate(array $array = []) |
|
| 51 | + public function populate(array $array = [ ]) |
|
| 52 | 52 | { |
| 53 | 53 | $state = get_object_vars($this); |
| 54 | 54 | |
@@ -7,7 +7,7 @@ |
||
| 7 | 7 | /** |
| 8 | 8 | * @var array |
| 9 | 9 | */ |
| 10 | - private $errors = []; |
|
| 10 | + private $errors = [ ]; |
|
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | 13 | * @param array $errors |
@@ -35,16 +35,16 @@ |
||
| 35 | 35 | */ |
| 36 | 36 | public function create(array $data) |
| 37 | 37 | { |
| 38 | - if (!isset($data['data']) && !isset($data['aggregateItems'])) { |
|
| 38 | + if (!isset($data[ 'data' ]) && !isset($data[ 'aggregateItems' ])) { |
|
| 39 | 39 | return new $this->entityClass($data); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | $reflector = new \ReflectionClass($this->entityClass); |
| 43 | 43 | |
| 44 | - $istanceArgs = [$data['data']]; |
|
| 44 | + $istanceArgs = [ $data[ 'data' ] ]; |
|
| 45 | 45 | |
| 46 | - foreach ($data['aggregateItems'] as $aggregateItem) { |
|
| 47 | - $istanceArgs[] = $aggregateItem; |
|
| 46 | + foreach ($data[ 'aggregateItems' ] as $aggregateItem) { |
|
| 47 | + $istanceArgs[ ] = $aggregateItem; |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | return $reflector->newInstanceArgs($istanceArgs); |
@@ -27,10 +27,10 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | public function getValuesByEntityMethod($entityMethod) |
| 29 | 29 | { |
| 30 | - $values = []; |
|
| 30 | + $values = [ ]; |
|
| 31 | 31 | |
| 32 | 32 | foreach ($this->getArrayCopy() as $entity) { |
| 33 | - $values[] = $entity->$entityMethod(); |
|
| 33 | + $values[ ] = $entity->$entityMethod(); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | return $values; |
@@ -67,10 +67,10 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | public function getIds() |
| 69 | 69 | { |
| 70 | - $ids = []; |
|
| 70 | + $ids = [ ]; |
|
| 71 | 71 | |
| 72 | 72 | foreach ($this as $entity) { |
| 73 | - $ids[] = $entity->getId(); |
|
| 73 | + $ids[ ] = $entity->getId(); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | return $ids; |
@@ -83,16 +83,16 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | public function getValueByAttribute($attribute, $unique = true) |
| 85 | 85 | { |
| 86 | - $methodName = 'get' . ucfirst($attribute); |
|
| 86 | + $methodName = 'get'.ucfirst($attribute); |
|
| 87 | 87 | |
| 88 | 88 | if (!method_exists(reset($this), $methodName)) { |
| 89 | - throw new \RuntimeException("Entity " . get_class(reset($this)) . " does not have a method $methodName"); |
|
| 89 | + throw new \RuntimeException("Entity ".get_class(reset($this))." does not have a method $methodName"); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - $result = []; |
|
| 92 | + $result = [ ]; |
|
| 93 | 93 | |
| 94 | 94 | foreach ($this as $entity) { |
| 95 | - $result[] = $entity->{$methodName}(); |
|
| 95 | + $result[ ] = $entity->{$methodName}(); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | if ($unique) { |