Completed
Push — master ( c828c8...de61b3 )
by Alexander
11:08
created
src/Traits/ConvertsParameters.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -19,9 +19,9 @@  discard block
 block discarded – undo
19 19
      * @param  string $key
20 20
      * @return bool
21 21
      */
22
-    public function __isset($key)
22
+    public function __isset( $key )
23 23
     {
24
-        return parent::__isset(snake_case($key));
24
+        return parent::__isset( snake_case( $key ) );
25 25
     }
26 26
 
27 27
     /**
@@ -30,9 +30,9 @@  discard block
 block discarded – undo
30 30
      * @param  string $key
31 31
      * @return mixed
32 32
      */
33
-    public function __get($key)
33
+    public function __get( $key )
34 34
     {
35
-        return parent::__get(snake_case($key));
35
+        return parent::__get( snake_case( $key ) );
36 36
     }
37 37
 
38 38
     /**
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
      */
43 43
     protected function getValidatorInstance()
44 44
     {
45
-        $this->getInputSource()->replace($this->getConvertedParameters());
45
+        $this->getInputSource()->replace( $this->getConvertedParameters() );
46 46
 
47 47
         return parent::getValidatorInstance();
48 48
     }
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
     protected function getConvertedParameters():array
63 63
     {
64 64
         $parameters = $this->all();
65
-        $parameters = $this->castBooleans($parameters);
66
-        $parameters = $this->convertToSnakeCase($parameters);
65
+        $parameters = $this->castBooleans( $parameters );
66
+        $parameters = $this->convertToSnakeCase( $parameters );
67 67
 
68
-        if (method_exists($this, 'convertParameters')) {
69
-            $parameters = $this->convertParameters($parameters);
68
+        if ( method_exists( $this, 'convertParameters' ) ) {
69
+            $parameters = $this->convertParameters( $parameters );
70 70
         }
71 71
 
72 72
         return $parameters;
@@ -85,16 +85,16 @@  discard block
 block discarded – undo
85 85
      * @param  mixed $input
86 86
      * @return array
87 87
      */
88
-    protected function castBooleans($input):array
88
+    protected function castBooleans( $input ):array
89 89
     {
90
-        if ($this->castToBooleanIsDisabled()) {
91
-            return [];
90
+        if ( $this->castToBooleanIsDisabled() ) {
91
+            return [ ];
92 92
         }
93 93
 
94
-        $casted = [];
94
+        $casted = [ ];
95 95
 
96
-        foreach ($input as $key => $value) {
97
-            $casted[$key] = $this->castValueToBoolean($value);
96
+        foreach ( $input as $key => $value ) {
97
+            $casted[ $key ] = $this->castValueToBoolean( $value );
98 98
         }
99 99
 
100 100
         return $casted;
@@ -116,10 +116,10 @@  discard block
 block discarded – undo
116 116
      * @param  mixed $value
117 117
      * @return mixed
118 118
      */
119
-    protected function castValueToBoolean($value)
119
+    protected function castValueToBoolean( $value )
120 120
     {
121
-        if (in_array($value, ['true', 'false'])) {
122
-            return filter_var($value, FILTER_VALIDATE_BOOLEAN);
121
+        if ( in_array( $value, [ 'true', 'false' ] ) ) {
122
+            return filter_var( $value, FILTER_VALIDATE_BOOLEAN );
123 123
         }
124 124
 
125 125
         return $value;
@@ -131,19 +131,19 @@  discard block
 block discarded – undo
131 131
      * @param  mixed $input
132 132
      * @return mixed
133 133
      */
134
-    protected function convertToSnakeCase($input)
134
+    protected function convertToSnakeCase( $input )
135 135
     {
136
-        if ($this->convertToSnakeCaseIsDisabled()) {
136
+        if ( $this->convertToSnakeCaseIsDisabled() ) {
137 137
             return;
138 138
         }
139 139
 
140
-        if (is_null($input)) {
140
+        if ( is_null( $input ) ) {
141 141
             return null;
142
-        } elseif (is_array($input)) {
143
-            return $this->convertArrayToSnakeCase($input);
142
+        } elseif ( is_array( $input ) ) {
143
+            return $this->convertArrayToSnakeCase( $input );
144 144
         }
145 145
 
146
-        return snake_case($input);
146
+        return snake_case( $input );
147 147
     }
148 148
 
149 149
     /**
@@ -162,12 +162,12 @@  discard block
 block discarded – undo
162 162
      * @param  array $input
163 163
      * @return array
164 164
      */
165
-    protected function convertArrayToSnakeCase(array $input):array
165
+    protected function convertArrayToSnakeCase( array $input ):array
166 166
     {
167
-        $converted = [];
167
+        $converted = [ ];
168 168
 
169
-        foreach ($input as $key => $value) {
170
-            $converted[snake_case($key)] = $value;
169
+        foreach ( $input as $key => $value ) {
170
+            $converted[ snake_case( $key ) ] = $value;
171 171
         }
172 172
 
173 173
         return $converted;
Please login to merge, or discard this patch.