@@ -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 | ; |
@@ -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 |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | public function testInvalidJsonShouldThrowInvalidArgumentExceptionError() |
41 | 41 | { |
42 | 42 | $this->setExpectedExceptionRegExp( |
43 | - \InvalidArgumentException::class, |
|
44 | - '/^Invalid submitted json data, error (.*) : (.*), json : invalid json$/' |
|
43 | + \InvalidArgumentException::class, |
|
44 | + '/^Invalid submitted json data, error (.*) : (.*), json : invalid json$/' |
|
45 | 45 | ); |
46 | 46 | $json = 'invalid json'; |
47 | 47 | |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | public function testEventWithoutStringShouldThrowInvalidArgumentExceptionError() |
56 | 56 | { |
57 | 57 | $this->setExpectedExceptionRegExp( |
58 | - \InvalidArgumentException::class, |
|
59 | - '/^Invalid argument: the submitted variable must be a string when you enable the json_format option.$/' |
|
58 | + \InvalidArgumentException::class, |
|
59 | + '/^Invalid argument: the submitted variable must be a string when you enable the json_format option.$/' |
|
60 | 60 | ); |
61 | 61 | $json = ['invalid json']; |
62 | 62 |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | public function testSubmitInvalidJsonShouldThrowException() |
54 | 54 | { |
55 | 55 | $this->setExpectedExceptionRegExp( |
56 | - 'InvalidArgumentException', |
|
57 | - '/^Invalid submitted json data, error (.*) : (.*), json : invalid json$/' |
|
56 | + 'InvalidArgumentException', |
|
57 | + '/^Invalid submitted json data, error (.*) : (.*), json : invalid json$/' |
|
58 | 58 | ); |
59 | 59 | $this->form->submit('invalid json'); |
60 | 60 | } |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | public function testSubmitWithoutStringShouldThrowException() |
71 | 71 | { |
72 | 72 | $this->setExpectedExceptionRegExp( |
73 | - 'InvalidArgumentException', |
|
74 | - '/^Invalid argument: the submitted variable must be a string when you enable the json_format option.$/' |
|
73 | + 'InvalidArgumentException', |
|
74 | + '/^Invalid argument: the submitted variable must be a string when you enable the json_format option.$/' |
|
75 | 75 | ); |
76 | 76 | $this->form->submit(['invalid json']); |
77 | 77 | } |
@@ -88,8 +88,8 @@ discard block |
||
88 | 88 | public function testRequestWithInvalidJsonShouldTHrowException() |
89 | 89 | { |
90 | 90 | $this->setExpectedExceptionRegExp( |
91 | - 'InvalidArgumentException', |
|
92 | - '/^Invalid submitted json data, error (.*) : (.*), json : invalid json$/' |
|
91 | + 'InvalidArgumentException', |
|
92 | + '/^Invalid submitted json data, error (.*) : (.*), json : invalid json$/' |
|
93 | 93 | ); |
94 | 94 | $request = $this->getRequest('invalid json'); |
95 | 95 | $this->form->handleRequest($request); |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | public function testRequestWithoutStringShouldThrowException() |
99 | 99 | { |
100 | 100 | $this->setExpectedExceptionRegExp( |
101 | - 'InvalidArgumentException', |
|
102 | - '/^Invalid argument: the submitted variable must be a string when you enable the json_format option.$/' |
|
101 | + 'InvalidArgumentException', |
|
102 | + '/^Invalid argument: the submitted variable must be a string when you enable the json_format option.$/' |
|
103 | 103 | ); |
104 | 104 | $request = $this->getRequest(['test']); |
105 | 105 | $this->form->handleRequest($request); |