@@ -21,8 +21,7 @@ discard block |
||
| 21 | 21 | protected function mock($date) |
| 22 | 22 | { |
| 23 | 23 | $this->mockedDate = $date instanceof \DateTime ? |
| 24 | - $date : |
|
| 25 | - date_create($date) |
|
| 24 | + $date : date_create($date) |
|
| 26 | 25 | ; |
| 27 | 26 | } |
| 28 | 27 | |
@@ -36,13 +35,11 @@ discard block |
||
| 36 | 35 | public function now($format = null) |
| 37 | 36 | { |
| 38 | 37 | $date = $this->mockedDate instanceof \DateTime ? |
| 39 | - $this->mockedDate : |
|
| 40 | - new \DateTime() |
|
| 38 | + $this->mockedDate : new \DateTime() |
|
| 41 | 39 | ; |
| 42 | 40 | |
| 43 | 41 | return empty($format) ? |
| 44 | - $date : |
|
| 45 | - $date->format($format) |
|
| 42 | + $date : $date->format($format) |
|
| 46 | 43 | ; |
| 47 | 44 | } |
| 48 | 45 | } |
@@ -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 | ); |
@@ -63,8 +62,8 @@ discard block |
||
| 63 | 62 | protected function extractQueryFilter(Request $request) |
| 64 | 63 | { |
| 65 | 64 | return array_map( |
| 66 | - function ($value) { |
|
| 67 | - return array_filter(explode(',', trim($value, ',')), function ($var) { |
|
| 65 | + function($value) { |
|
| 66 | + return array_filter(explode(',', trim($value, ',')), function($var) { |
|
| 68 | 67 | return !empty($var); |
| 69 | 68 | }); |
| 70 | 69 | }, |
@@ -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 | } |
@@ -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 @@ discard block |
||
| 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; |
@@ -66,7 +65,7 @@ discard block |
||
| 66 | 65 | $options['options'] |
| 67 | 66 | ); |
| 68 | 67 | |
| 69 | - $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use ($builder, $handledLocales, $childrenOptions) { |
|
| 68 | + $builder->addEventListener(FormEvents::PRE_SET_DATA, function(FormEvent $event) use ($builder, $handledLocales, $childrenOptions) { |
|
| 70 | 69 | $form = $event->getForm(); |
| 71 | 70 | $data = $event->getData(); |
| 72 | 71 | |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | $arguments = array( |
| 54 | 54 | $entityClass, |
| 55 | 55 | array_map( |
| 56 | - function ($property) { return $property->getName(); }, |
|
| 56 | + function($property) { return $property->getName(); }, |
|
| 57 | 57 | $entityReflection->getProperties() |
| 58 | 58 | ), |
| 59 | 59 | $collectionClass, |
@@ -147,6 +147,8 @@ discard block |
||
| 147 | 147 | |
| 148 | 148 | /** |
| 149 | 149 | * Construct. |
| 150 | + * @param integer $id |
|
| 151 | + * @param integer $bladesNumber |
|
| 150 | 152 | */ |
| 151 | 153 | public function __construct($id, $bladesNumber = null, $nothing = 'wrong') |
| 152 | 154 | { |
@@ -164,6 +166,9 @@ discard block |
||
| 164 | 166 | return $this->id; |
| 165 | 167 | } |
| 166 | 168 | |
| 169 | + /** |
|
| 170 | + * @param string $color |
|
| 171 | + */ |
|
| 167 | 172 | public function setColor($color) { |
| 168 | 173 | $this->color = $color; |
| 169 | 174 | } |
@@ -69,8 +69,7 @@ discard block |
||
| 69 | 69 | public static function createNormalizer($key = 'default') |
| 70 | 70 | { |
| 71 | 71 | return isset(self::$instancePool[$key]) ? |
| 72 | - self::$instancePool[$key] : |
|
| 73 | - self::$instancePool[$key] = new static( |
|
| 72 | + self::$instancePool[$key] : self::$instancePool[$key] = new static( |
|
| 74 | 73 | PropertyAccess::createPropertyAccessor() |
| 75 | 74 | ); |
| 76 | 75 | } |
@@ -93,7 +92,7 @@ discard block |
||
| 93 | 92 | */ |
| 94 | 93 | private function createExtractorDelegate() |
| 95 | 94 | { |
| 96 | - return $this->extractorDelegate ?: $this->extractorDelegate = function () { |
|
| 95 | + return $this->extractorDelegate ?: $this->extractorDelegate = function() { |
|
| 97 | 96 | return get_object_vars($this); |
| 98 | 97 | }; |
| 99 | 98 | } |
@@ -105,7 +104,7 @@ discard block |
||
| 105 | 104 | */ |
| 106 | 105 | private function createReadingDelegate() |
| 107 | 106 | { |
| 108 | - return $this->readDelegate ?: $this->readDelegate = function ($property, PropertyAccessor $propertyAccessor) { |
|
| 107 | + return $this->readDelegate ?: $this->readDelegate = function($property, PropertyAccessor $propertyAccessor) { |
|
| 109 | 108 | switch (true) { |
| 110 | 109 | |
| 111 | 110 | // Public property / accessor case |
@@ -266,7 +265,7 @@ discard block |
||
| 266 | 265 | */ |
| 267 | 266 | private function createWrittingDelegate() |
| 268 | 267 | { |
| 269 | - return $this->writeDelegate ?: $this->writeDelegate = function (PropertyPathInterface $property, $value, PropertyAccessor $propertyAccessor) { |
|
| 268 | + return $this->writeDelegate ?: $this->writeDelegate = function(PropertyPathInterface $property, $value, PropertyAccessor $propertyAccessor) { |
|
| 270 | 269 | switch (true) { |
| 271 | 270 | |
| 272 | 271 | // Public property / accessor case |
@@ -300,15 +299,12 @@ discard block |
||
| 300 | 299 | $class = is_string($normalizable) ? |
| 301 | 300 | $normalizable : ( |
| 302 | 301 | $normalizable instanceof \ReflectionClass ? |
| 303 | - $normalizable->name : |
|
| 304 | - get_class($normalizable) |
|
| 302 | + $normalizable->name : get_class($normalizable) |
|
| 305 | 303 | ) |
| 306 | 304 | ; |
| 307 | 305 | $reflection = isset(self::$reflectionPool[$class]) ? |
| 308 | - self::$reflectionPool[$class] : |
|
| 309 | - self::$reflectionPool[$class] = $normalizable instanceof \ReflectionClass ? |
|
| 310 | - $normalizable : |
|
| 311 | - new \ReflectionClass($class) |
|
| 306 | + self::$reflectionPool[$class] : self::$reflectionPool[$class] = $normalizable instanceof \ReflectionClass ? |
|
| 307 | + $normalizable : new \ReflectionClass($class) |
|
| 312 | 308 | ; |
| 313 | 309 | |
| 314 | 310 | $object = $normalizable; |
@@ -335,8 +331,7 @@ discard block |
||
| 335 | 331 | $argKey = $this->inflector->snakelize($parameter->getName()); |
| 336 | 332 | if (isset($data[$argKey])) { |
| 337 | 333 | $arguments[] = $parameter->getClass() ? |
| 338 | - $this->normalize($data[$argKey], $parameter->getClass()) : |
|
| 339 | - $data[$argKey] |
|
| 334 | + $this->normalize($data[$argKey], $parameter->getClass()) : $data[$argKey] |
|
| 340 | 335 | ; |
| 341 | 336 | unset($data[$argKey]); |
| 342 | 337 | |
@@ -344,16 +339,14 @@ discard block |
||
| 344 | 339 | } |
| 345 | 340 | |
| 346 | 341 | $arguments[] = $parameter->isOptional() ? |
| 347 | - $parameter->getDefaultValue() : |
|
| 348 | - null |
|
| 342 | + $parameter->getDefaultValue() : null |
|
| 349 | 343 | ; |
| 350 | 344 | } |
| 351 | 345 | } |
| 352 | 346 | } |
| 353 | 347 | |
| 354 | 348 | $object = empty($arguments) ? |
| 355 | - $reflection->newInstance() : |
|
| 356 | - $reflection->newInstanceArgs($arguments); |
|
| 349 | + $reflection->newInstance() : $reflection->newInstanceArgs($arguments); |
|
| 357 | 350 | } |
| 358 | 351 | |
| 359 | 352 | // BAD ! |
@@ -79,7 +79,7 @@ |
||
| 79 | 79 | ->setAllowedTypes('loader_method', array('null', 'string')) |
| 80 | 80 | ->setDefaults(array( |
| 81 | 81 | 'choice_label' => function($choice) { |
| 82 | - return (string)$choice; |
|
| 82 | + return (string) $choice; |
|
| 83 | 83 | }, |
| 84 | 84 | 'choice_value' => 'id', |
| 85 | 85 | 'choices' => $choices, |