@@ -68,8 +68,7 @@ discard block |
||
| 68 | 68 | */ |
| 69 | 69 | private function getPropertyAccessor() |
| 70 | 70 | { |
| 71 | - $this->propertyAccessor = $this->propertyAccessor ?: |
|
| 72 | - PropertyAccess::createPropertyAccessor() |
|
| 71 | + $this->propertyAccessor = $this->propertyAccessor ?: PropertyAccess::createPropertyAccessor() |
|
| 73 | 72 | ; |
| 74 | 73 | |
| 75 | 74 | return $this->propertyAccessor; |
@@ -127,8 +126,7 @@ discard block |
||
| 127 | 126 | $propertyAccessor = $this->getPropertyAccessor(); |
| 128 | 127 | if (!$this->_has($field)) { |
| 129 | 128 | return $propertyAccessor->isReadable($object, $field) ? |
| 130 | - $propertyAccessor->getValue($object, $field) : |
|
| 131 | - null |
|
| 129 | + $propertyAccessor->getValue($object, $field) : null |
|
| 132 | 130 | ; |
| 133 | 131 | } |
| 134 | 132 | |
@@ -157,7 +155,7 @@ discard block |
||
| 157 | 155 | $data = $this->getAttributes()->toArray(); |
| 158 | 156 | |
| 159 | 157 | $scopes = $this->getScopes(); |
| 160 | - if(empty($scopes[$scope])) { |
|
| 158 | + if (empty($scopes[$scope])) { |
|
| 161 | 159 | return $data; |
| 162 | 160 | } |
| 163 | 161 | |
@@ -167,11 +165,9 @@ discard block |
||
| 167 | 165 | $normalizedData[$field] = $propertyAccessor->isReadable( |
| 168 | 166 | $data, |
| 169 | 167 | $propertyPath = strpos($field, '[') === 0 ? |
| 170 | - $field : |
|
| 171 | - sprintf('[%s]', $field) |
|
| 168 | + $field : sprintf('[%s]', $field) |
|
| 172 | 169 | ) ? |
| 173 | - $propertyAccessor->getValue($data, $propertyPath) : |
|
| 174 | - null |
|
| 170 | + $propertyAccessor->getValue($data, $propertyPath) : null |
|
| 175 | 171 | ; |
| 176 | 172 | } |
| 177 | 173 | |
@@ -36,8 +36,7 @@ |
||
| 36 | 36 | return $this->actionFactory |
| 37 | 37 | ->createAction($name) |
| 38 | 38 | ->denormalize(isset($arguments[0]) && is_array($arguments[0]) ? |
| 39 | - $arguments[0] : |
|
| 40 | - array() |
|
| 39 | + $arguments[0] : array() |
|
| 41 | 40 | ) |
| 42 | 41 | ->init($relatedEntity, ...$arguments) |
| 43 | 42 | ; |
@@ -28,8 +28,7 @@ |
||
| 28 | 28 | protected function formatDateTime(\DateTime $date = null, $format = null) |
| 29 | 29 | { |
| 30 | 30 | return $date && $format ? |
| 31 | - $date->format($format) : |
|
| 32 | - $date |
|
| 31 | + $date->format($format) : $date |
|
| 33 | 32 | ; |
| 34 | 33 | } |
| 35 | 34 | |
@@ -52,8 +52,7 @@ |
||
| 52 | 52 | |
| 53 | 53 | // default locale matched |
| 54 | 54 | return $this->defaultLocale && isset($translationData[$this->defaultLocale]) ? |
| 55 | - $translationData[$this->defaultLocale] : |
|
| 56 | - $default |
|
| 55 | + $translationData[$this->defaultLocale] : $default |
|
| 57 | 56 | ; |
| 58 | 57 | } |
| 59 | 58 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | public function normalize($scope = 'default') |
| 39 | 39 | { |
| 40 | 40 | return $this |
| 41 | - ->map(function (NormalizableInterface $entity) use ($scope) { |
|
| 41 | + ->map(function(NormalizableInterface $entity) use ($scope) { |
|
| 42 | 42 | return $entity->normalize($scope); |
| 43 | 43 | }) |
| 44 | 44 | ->toArray() |
@@ -92,13 +92,12 @@ discard block |
||
| 92 | 92 | { |
| 93 | 93 | $propertyAccessor = PropertyAccess::createPropertyAccessor(); |
| 94 | 94 | |
| 95 | - return $this->filter(function (CollectionableInterface $entity) use ($filters, $propertyAccessor) { |
|
| 95 | + return $this->filter(function(CollectionableInterface $entity) use ($filters, $propertyAccessor) { |
|
| 96 | 96 | $res = true; |
| 97 | 97 | foreach ($filters as $key => $value) { |
| 98 | 98 | $current = $propertyAccessor->getValue($entity, $key); |
| 99 | 99 | $res = $res && (is_array($value) ? |
| 100 | - in_array($current, $value) : |
|
| 101 | - $current == $value |
|
| 100 | + in_array($current, $value) : $current == $value |
|
| 102 | 101 | ); |
| 103 | 102 | } |
| 104 | 103 | |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | $statusCode = $exception instanceof HttpException ? $exception->getStatusCode() : 500; |
| 63 | 63 | $errors = array(); |
| 64 | 64 | |
| 65 | - switch(true) { |
|
| 65 | + switch (true) { |
|
| 66 | 66 | |
| 67 | 67 | // validation exception |
| 68 | 68 | case $exception instanceof ValidationException : |
@@ -99,8 +99,7 @@ discard block |
||
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | $violation = $violation instanceof FormError ? |
| 102 | - $violation->getCause() : |
|
| 103 | - $violation |
|
| 102 | + $violation->getCause() : $violation |
|
| 104 | 103 | ; |
| 105 | 104 | |
| 106 | 105 | $errors[(string) $violation->getPropertyPath()] = $violation->getMessage(); |
@@ -56,8 +56,7 @@ discard block |
||
| 56 | 56 | 'Validation failed on %s%s', |
| 57 | 57 | $this->entity ? get_class($this->entity) : '', |
| 58 | 58 | $this->entity instanceof CollectionableInterface ? |
| 59 | - sprintf('#%s', $this->entity->getId()) : |
|
| 60 | - '' |
|
| 59 | + sprintf('#%s', $this->entity->getId()) : '' |
|
| 61 | 60 | , |
| 62 | 61 | empty($this->groups) ? '' : sprintf(' for ["%s"] groups', |
| 63 | 62 | implode('", "', $this->groups) |
@@ -96,8 +95,7 @@ discard block |
||
| 96 | 95 | public function getReport() |
| 97 | 96 | { |
| 98 | 97 | return $this->report ? |
| 99 | - $this->report : |
|
| 100 | - new EntityCollection() |
|
| 98 | + $this->report : new EntityCollection() |
|
| 101 | 99 | ; |
| 102 | 100 | } |
| 103 | 101 | |
@@ -106,14 +104,14 @@ discard block |
||
| 106 | 104 | * |
| 107 | 105 | * @return array |
| 108 | 106 | */ |
| 109 | - public function formatReport(){ |
|
| 107 | + public function formatReport() { |
|
| 110 | 108 | $messages = array(); |
| 111 | 109 | $report = $this->getReport(); |
| 112 | 110 | |
| 113 | - switch(true){ |
|
| 111 | + switch (true) { |
|
| 114 | 112 | |
| 115 | 113 | case $report instanceof ConstraintViolationListInterface: |
| 116 | - foreach ($report as $constraintViolation){ |
|
| 114 | + foreach ($report as $constraintViolation) { |
|
| 117 | 115 | $messages[] = $constraintViolation->getMessage(); |
| 118 | 116 | } |
| 119 | 117 | break; |
@@ -18,8 +18,7 @@ discard block |
||
| 18 | 18 | public function serialize($data, $scope) |
| 19 | 19 | { |
| 20 | 20 | return $data instanceof SerializableInterface ? |
| 21 | - $data->serialize($scope) : |
|
| 22 | - (array) $data |
|
| 21 | + $data->serialize($scope) : (array) $data |
|
| 23 | 22 | ; |
| 24 | 23 | } |
| 25 | 24 | |
@@ -35,8 +34,7 @@ discard block |
||
| 35 | 34 | $object = new $output(); |
| 36 | 35 | |
| 37 | 36 | return $object instanceof SerializableInterface ? |
| 38 | - $object->deserialize($data) : |
|
| 39 | - $object |
|
| 37 | + $object->deserialize($data) : $object |
|
| 40 | 38 | ; |
| 41 | 39 | } |
| 42 | 40 | } |
@@ -17,8 +17,7 @@ |
||
| 17 | 17 | public function serialize($data, $scope) |
| 18 | 18 | { |
| 19 | 19 | return json_encode($data instanceof NormalizableInterface ? |
| 20 | - $this->normalizer->normalize($data, $scope) : |
|
| 21 | - $data |
|
| 20 | + $this->normalizer->normalize($data, $scope) : $data |
|
| 22 | 21 | ); |
| 23 | 22 | } |
| 24 | 23 | |