@@ -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; |
@@ -106,7 +106,8 @@ |
||
106 | 106 | * |
107 | 107 | * @return array |
108 | 108 | */ |
109 | - public function formatReport(){ |
|
109 | + public function formatReport() |
|
110 | + { |
|
110 | 111 | $messages = array(); |
111 | 112 | $report = $this->getReport(); |
112 | 113 |
@@ -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 |
@@ -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 | } |
@@ -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; |