@@ -13,26 +13,26 @@ discard block |
||
13 | 13 | */ |
14 | 14 | class ViolationMessageSerializer implements Serializer { |
15 | 15 | |
16 | - private function abbreviateViolationMessageKey( $fullMessageKey ) { |
|
17 | - return substr( $fullMessageKey, strlen( ViolationMessage::MESSAGE_KEY_PREFIX ) ); |
|
16 | + private function abbreviateViolationMessageKey($fullMessageKey) { |
|
17 | + return substr($fullMessageKey, strlen(ViolationMessage::MESSAGE_KEY_PREFIX)); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | /** |
21 | 21 | * @param ViolationMessage $object |
22 | 22 | * @return array |
23 | 23 | */ |
24 | - public function serialize( $object ) { |
|
24 | + public function serialize($object) { |
|
25 | 25 | /** @var ViolationMessage $object */ |
26 | - Assert::parameterType( ViolationMessage::class, $object, '$object' ); |
|
26 | + Assert::parameterType(ViolationMessage::class, $object, '$object'); |
|
27 | 27 | |
28 | 28 | $arguments = $object->getArguments(); |
29 | 29 | $serializedArguments = []; |
30 | - foreach ( $arguments as $argument ) { |
|
31 | - $serializedArguments[] = $this->serializeArgument( $argument ); |
|
30 | + foreach ($arguments as $argument) { |
|
31 | + $serializedArguments[] = $this->serializeArgument($argument); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | return [ |
35 | - 'k' => $this->abbreviateViolationMessageKey( $object->getMessageKey() ), |
|
35 | + 'k' => $this->abbreviateViolationMessageKey($object->getMessageKey()), |
|
36 | 36 | 'a' => $serializedArguments, |
37 | 37 | ]; |
38 | 38 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * @return array [ 't' => ViolationMessage::TYPE_*, 'v' => serialized value, |
43 | 43 | * 'r' => $role, (optional) 'a' => $alternativeMessageKey ] |
44 | 44 | */ |
45 | - private function serializeArgument( array $argument ) { |
|
45 | + private function serializeArgument(array $argument) { |
|
46 | 46 | $methods = [ |
47 | 47 | ]; |
48 | 48 | |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | $value = $argument['value']; |
51 | 51 | $role = $argument['role']; |
52 | 52 | |
53 | - if ( array_key_exists( $type, $methods ) ) { |
|
53 | + if (array_key_exists($type, $methods)) { |
|
54 | 54 | $method = $methods[$type]; |
55 | - $serializedValue = $this->$method( $value ); |
|
55 | + $serializedValue = $this->$method($value); |
|
56 | 56 | } else { |
57 | 57 | throw new InvalidArgumentException( |
58 | - 'Unknown ViolationMessage argument type ' . $type . '!' |
|
58 | + 'Unknown ViolationMessage argument type '.$type.'!' |
|
59 | 59 | ); |
60 | 60 | } |
61 | 61 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | 'r' => $role, |
66 | 66 | ]; |
67 | 67 | |
68 | - if ( array_key_exists( 'alternativeMessageKey', $argument ) ) { |
|
68 | + if (array_key_exists('alternativeMessageKey', $argument)) { |
|
69 | 69 | $serialized['a'] = $this->abbreviateViolationMessageKey( |
70 | 70 | $argument['alternativeMessageKey'] |
71 | 71 | ); |