@@ -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 | |
@@ -35,8 +35,7 @@ discard block |
||
| 35 | 35 | { |
| 36 | 36 | if ($data !== null) { |
| 37 | 37 | $data = is_string($data) ? |
| 38 | - $data : |
|
| 39 | - $this->container->get('serializer')->serialize( |
|
| 38 | + $data : $this->container->get('serializer')->serialize( |
|
| 40 | 39 | $data, 'json', empty($scope) ? array() : array('scope' => $scope) |
| 41 | 40 | ) |
| 42 | 41 | ; |
@@ -127,9 +126,8 @@ discard block |
||
| 127 | 126 | } |
| 128 | 127 | |
| 129 | 128 | // data camel case normalization |
| 130 | - return $inflection && $this->container->has('majora.inflector')? |
|
| 131 | - $this->container->get('majora.inflector')->normalize($data, $inflection) : |
|
| 132 | - $data |
|
| 129 | + return $inflection && $this->container->has('majora.inflector') ? |
|
| 130 | + $this->container->get('majora.inflector')->normalize($data, $inflection) : $data |
|
| 133 | 131 | ; |
| 134 | 132 | } |
| 135 | 133 | |
@@ -210,8 +208,7 @@ discard block |
||
| 210 | 208 | $subRequest = $request->duplicate(); |
| 211 | 209 | $subRequest->attributes->set('_controller', $forwardOptions['controller']); |
| 212 | 210 | $subRequest->setMethod(isset($forwardOptions['method']) ? |
| 213 | - $forwardOptions['method'] : |
|
| 214 | - 'GET' |
|
| 211 | + $forwardOptions['method'] : 'GET' |
|
| 215 | 212 | ); |
| 216 | 213 | |
| 217 | 214 | return $this->container->get('http_kernel')->handle( |
@@ -54,8 +54,7 @@ |
||
| 54 | 54 | public function buildForm(FormBuilderInterface $builder, array $options) |
| 55 | 55 | { |
| 56 | 56 | $handledLocales = empty($options['locales']) ? |
| 57 | - $this->locales : |
|
| 58 | - array_intersect($this->locales, $options['locales']) |
|
| 57 | + $this->locales : array_intersect($this->locales, $options['locales']) |
|
| 59 | 58 | ; |
| 60 | 59 | if (empty($handledLocales)) { |
| 61 | 60 | return; |
@@ -46,8 +46,7 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | return $this->container->get('security.authorization_checker')->isGranted( |
| 48 | 48 | (array) (empty($securityMapping[$intention]) ? |
| 49 | - $intention : |
|
| 50 | - $securityMapping[$intention] |
|
| 49 | + $intention : $securityMapping[$intention] |
|
| 51 | 50 | ), |
| 52 | 51 | $resource |
| 53 | 52 | ); |
@@ -110,8 +109,7 @@ discard block |
||
| 110 | 109 | return new NotFoundHttpException(sprintf('Entity with id "%s" not found%s.', |
| 111 | 110 | $entityId, |
| 112 | 111 | $this->container->getParameter('kernel.debug') ? |
| 113 | - sprintf(' : (looked into "%s")', $loaderId) : |
|
| 114 | - '' |
|
| 112 | + sprintf(' : (looked into "%s")', $loaderId) : '' |
|
| 115 | 113 | )); |
| 116 | 114 | } |
| 117 | 115 | } |
@@ -43,8 +43,7 @@ |
||
| 43 | 43 | array $defaultOptions = array(), |
| 44 | 44 | array $defaultBodyData = array(), |
| 45 | 45 | array $routeMapping = array() |
| 46 | - ) |
|
| 47 | - { |
|
| 46 | + ) { |
|
| 48 | 47 | $this->urlGenerator = $urlGenerator; |
| 49 | 48 | $this->defaultOptions = $defaultOptions; |
| 50 | 49 | $this->defaultBodyData = $defaultBodyData; |
@@ -62,8 +62,7 @@ discard block |
||
| 62 | 62 | public static function createNormalizer($key = 'default') |
| 63 | 63 | { |
| 64 | 64 | return isset(self::$instancePool[$key]) ? |
| 65 | - self::$instancePool[$key] : |
|
| 66 | - self::$instancePool[$key] = new static( |
|
| 65 | + self::$instancePool[$key] : self::$instancePool[$key] = new static( |
|
| 67 | 66 | PropertyAccess::createPropertyAccessor() |
| 68 | 67 | ); |
| 69 | 68 | } |
@@ -293,15 +292,12 @@ discard block |
||
| 293 | 292 | $class = is_string($normalizable) ? |
| 294 | 293 | $normalizable : ( |
| 295 | 294 | $normalizable instanceof \ReflectionClass ? |
| 296 | - $normalizable->name : |
|
| 297 | - get_class($normalizable) |
|
| 295 | + $normalizable->name : get_class($normalizable) |
|
| 298 | 296 | ) |
| 299 | 297 | ; |
| 300 | 298 | $reflection = isset(self::$reflectionPool[$class]) ? |
| 301 | - self::$reflectionPool[$class] : |
|
| 302 | - self::$reflectionPool[$class] = $normalizable instanceof \ReflectionClass ? |
|
| 303 | - $normalizable : |
|
| 304 | - new \ReflectionClass($class) |
|
| 299 | + self::$reflectionPool[$class] : self::$reflectionPool[$class] = $normalizable instanceof \ReflectionClass ? |
|
| 300 | + $normalizable : new \ReflectionClass($class) |
|
| 305 | 301 | ; |
| 306 | 302 | |
| 307 | 303 | $object = $normalizable; |
@@ -328,8 +324,7 @@ discard block |
||
| 328 | 324 | $argKey = $this->inflector->snakelize($parameter->getName()); |
| 329 | 325 | if (isset($data[$argKey])) { |
| 330 | 326 | $arguments[] = $parameter->getClass() ? |
| 331 | - $this->normalize($data[$argKey], $parameter->getClass()) : |
|
| 332 | - $data[$argKey] |
|
| 327 | + $this->normalize($data[$argKey], $parameter->getClass()) : $data[$argKey] |
|
| 333 | 328 | ; |
| 334 | 329 | unset($data[$argKey]); |
| 335 | 330 | |
@@ -337,16 +332,14 @@ discard block |
||
| 337 | 332 | } |
| 338 | 333 | |
| 339 | 334 | $arguments[] = $parameter->isOptional() ? |
| 340 | - $parameter->getDefaultValue() : |
|
| 341 | - null |
|
| 335 | + $parameter->getDefaultValue() : null |
|
| 342 | 336 | ; |
| 343 | 337 | } |
| 344 | 338 | } |
| 345 | 339 | } |
| 346 | 340 | |
| 347 | 341 | $object = empty($arguments) ? |
| 348 | - $reflection->newInstance() : |
|
| 349 | - $reflection->newInstanceArgs($arguments); |
|
| 342 | + $reflection->newInstance() : $reflection->newInstanceArgs($arguments); |
|
| 350 | 343 | } |
| 351 | 344 | |
| 352 | 345 | // BAD ! |
@@ -2,11 +2,9 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Majora\Framework\Domain\Action\Dal; |
| 4 | 4 | |
| 5 | -use Majora\Framework\Api\Client\RestApiClient; |
|
| 6 | 5 | use Majora\Framework\Validation\ValidationException; |
| 7 | 6 | use Symfony\Component\EventDispatcher\Event; |
| 8 | 7 | use Symfony\Component\EventDispatcher\EventDispatcherInterface; |
| 9 | -use Symfony\Component\Serializer\SerializerInterface; |
|
| 10 | 8 | use Symfony\Component\Validator\Validator\ValidatorInterface; |
| 11 | 9 | |
| 12 | 10 | /** |
@@ -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 | |
@@ -111,10 +109,10 @@ discard block |
||
| 111 | 109 | $messages = array(); |
| 112 | 110 | $report = $this->getReport(); |
| 113 | 111 | |
| 114 | - switch(true){ |
|
| 112 | + switch (true) { |
|
| 115 | 113 | |
| 116 | 114 | case $report instanceof ConstraintViolationListInterface: |
| 117 | - foreach ($report as $constraintViolation){ |
|
| 115 | + foreach ($report as $constraintViolation) { |
|
| 118 | 116 | $messages[] = $constraintViolation->getMessage(); |
| 119 | 117 | } |
| 120 | 118 | break; |