Completed
Push — master ( 0da9d4...b286ff )
by Adrian
04:05
created
src/Element/Factory.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,6 @@
 block discarded – undo
3 3
 
4 4
 use Sirius\Input\Element\Input;
5 5
 use Sirius\Input\Element;
6
-use Sirius\Input\Specs;
7 6
 
8 7
 class Factory
9 8
 {
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,13 +30,13 @@  discard block
 block discarded – undo
30 30
 
31 31
             return $this;
32 32
         }
33
-        if ( ! is_string($classOrClosure)) {
33
+        if (!is_string($classOrClosure)) {
34 34
             throw new \RuntimeException('Input type must be a class or a closure');
35 35
         }
36
-        if ( ! class_exists($classOrClosure)) {
36
+        if (!class_exists($classOrClosure)) {
37 37
             throw new \RuntimeException(sprintf('Class %s does not exist', $classOrClosure));
38 38
         }
39
-        if ( ! is_subclass_of($classOrClosure, '\Sirius\Input\Element')) {
39
+        if (!is_subclass_of($classOrClosure, '\Sirius\Input\Element')) {
40 40
             throw new \RuntimeException(
41 41
                 sprintf('Class %s must extend the \Sirius\Input\Element class', $classOrClosure)
42 42
             );
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
             $element = new $class($name, $options);
71 71
         }
72 72
 
73
-        if ( ! $element instanceof Element) {
73
+        if (!$element instanceof Element) {
74 74
             throw new \RuntimeException('Cannot create a valid element based on the data provided');
75 75
         }
76 76
 
Please login to merge, or discard this patch.
src/Element/Input/MultiSelect.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,6 @@
 block discarded – undo
2 2
 namespace Sirius\Input\Element\Input;
3 3
 
4 4
 use Sirius\Input\Specs;
5
-use Sirius\Filtration\Filter\Callback;
6 5
 
7 6
 class MultiSelect extends Select
8 7
 {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,10 +27,10 @@
 block discarded – undo
27 27
      */
28 28
     function filterValue($value, $valueIdentifier = null)
29 29
     {
30
-        if ( ! $value) {
30
+        if (!$value) {
31 31
             return null;
32 32
         }
33
-        if ( ! is_array($value)) {
33
+        if (!is_array($value)) {
34 34
             $value = (array) $value;
35 35
         }
36 36
         $allowedValues = array_keys($this->getOptions());
Please login to merge, or discard this patch.
src/InputFilter.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,6 @@
 block discarded – undo
3 3
 
4 4
 use Sirius\Filtration\Filtrator;
5 5
 use Sirius\Filtration\FiltratorInterface;
6
-use Sirius\Input\Element\AbstractElement;
7 6
 use Sirius\Input\Element\Factory as ElementFactory;
8 7
 use Sirius\Input\Traits\HasChildrenTrait;
9 8
 use Sirius\Input\Traits\HasAttributesTrait;
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -77,17 +77,17 @@  discard block
 block discarded – undo
77 77
         ValidatorInterface $validator = null,
78 78
         FiltratorInterface $filtrator = null
79 79
     ) {
80
-        if ( ! $elementFactory) {
80
+        if (!$elementFactory) {
81 81
             $elementFactory = new ElementFactory();
82 82
         }
83 83
         $this->elementFactory = $elementFactory;
84 84
 
85
-        if ( ! $validator) {
85
+        if (!$validator) {
86 86
             $validator = new Validator();
87 87
         }
88 88
         $this->validator = $validator;
89 89
 
90
-        if ( ! $filtrator) {
90
+        if (!$filtrator) {
91 91
             $filtrator = new Filtrator();
92 92
         }
93 93
         $this->filtrator = $filtrator;
@@ -150,11 +150,11 @@  discard block
 block discarded – undo
150 150
      */
151 151
     function prepare($force = false)
152 152
     {
153
-        if ($this->isPrepared && ! $force) {
153
+        if ($this->isPrepared && !$force) {
154 154
             return $this;
155 155
         }
156 156
         $this->init();
157
-        if ( ! $this->isInitialized()) {
157
+        if (!$this->isInitialized()) {
158 158
             throw new \LogicException('Input was not properly initialized');
159 159
         }
160 160
 
@@ -197,12 +197,12 @@  discard block
 block discarded – undo
197 197
     protected function prepareFiltration()
198 198
     {
199 199
         $filters = $this->getFilters();
200
-        if ( ! $filters || ! is_array($filters)) {
200
+        if (!$filters || !is_array($filters)) {
201 201
             return;
202 202
         }
203 203
         $filtrator = $this->getFiltrator();
204 204
         foreach ($filters as $filter) {
205
-            $params = is_array($filter) ? $filter : array( $filter );
205
+            $params = is_array($filter) ? $filter : array($filter);
206 206
             if (isset($params[0])) {
207 207
                 $filtrator->add(Filtrator::SELECTOR_ROOT, $params[0], @$params[1], @$params[2], @$params[3]);
208 208
             }
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
      */
248 248
     function getUploadHandlers()
249 249
     {
250
-        if ( ! $this->uploadHandlers) {
250
+        if (!$this->uploadHandlers) {
251 251
             $this->uploadHandlers = new UploadHandlerAggregate;
252 252
         }
253 253
 
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
     function populate($values = array())
283 283
     {
284 284
         $this->prepare();
285
-        if ( ! $this->isPrepared()) {
285
+        if (!$this->isPrepared()) {
286 286
             throw new \LogicException('Input was not prepared and cannot receive data');
287 287
         }
288 288
 
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
      */
332 332
     function isValid($skipDataProcessing = false)
333 333
     {
334
-        if ( ! $skipDataProcessing) {
334
+        if (!$skipDataProcessing) {
335 335
             $this->values = $this->getFiltrator()->filter($this->rawValues);
336 336
         }
337 337
 
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
         $validator = $this->getValidator();
340 340
         $validator->validate($this->values);
341 341
 
342
-        if ( ! $skipDataProcessing) {
342
+        if (!$skipDataProcessing) {
343 343
             $this->processUploads();
344 344
         }
345 345
 
Please login to merge, or discard this patch.
src/AttributesContainer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
 
20 20
     function removeClass($className)
21 21
     {
22
-        if ( ! $this->hasClass($className)) {
22
+        if (!$this->hasClass($className)) {
23 23
             return;
24 24
         }
25 25
         $classes = preg_replace('/\b' . $className . '\b/i', '', $this->get('class'));
Please login to merge, or discard this patch.
src/DataContainer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 
14 14
             return;
15 15
         }
16
-        if ( ! is_string($nameOrArray)) {
16
+        if (!is_string($nameOrArray)) {
17 17
             throw new \InvalidArgumentException('Only strings or arrays are accepted as first argument of the set() method of the DataContainer class');
18 18
         }
19 19
         if ($value !== null) {
Please login to merge, or discard this patch.
src/Element/Input/File.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,8 +43,8 @@
 block discarded – undo
43 43
         );
44 44
         if (is_array($this->getUploadRules())) {
45 45
             foreach ($this->getUploadRules() as $rule) {
46
-                if ( ! is_array($rule)) {
47
-                    $rule = array( $rule );
46
+                if (!is_array($rule)) {
47
+                    $rule = array($rule);
48 48
                 }
49 49
                 $name    = $rule[0];
50 50
                 $options = isset($rule[1]) ? $rule[1] : null;
Please login to merge, or discard this patch.
src/Element/Input/Select.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
             $this->getName(),
72 72
             'callback',
73 73
             array(
74
-                Callback::OPTION_CALLBACK => array( $this, 'filterValue' )
74
+                Callback::OPTION_CALLBACK => array($this, 'filterValue')
75 75
             )
76 76
         );
77 77
     }
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
      */
87 87
     function filterValue($value, $valueIdentifier = null)
88 88
     {
89
-        if ( ! $value) {
89
+        if (!$value) {
90 90
             return null;
91 91
         }
92 92
         $allowedValues = array_keys($this->getOptions());
Please login to merge, or discard this patch.
src/Traits/HasAttributesTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
 
10 10
     protected function ensureAttributes()
11 11
     {
12
-        if ( ! isset($this[Specs::ATTRIBUTES])) {
12
+        if (!isset($this[Specs::ATTRIBUTES])) {
13 13
             $this[Specs::ATTRIBUTES] = new AttributesContainer();
14 14
         }
15 15
     }
Please login to merge, or discard this patch.
src/Traits/HasChildrenTrait.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
             throw new \RuntimeException(sprintf('Variable $nameorElement must be a string or an instance of the Element class'));
62 62
         }
63 63
         // add the index for sorting
64
-        if ( ! isset($element['__index'])) {
65
-            $element['__index'] = ($this->elementsIndex --);
64
+        if (!isset($element['__index'])) {
65
+            $element['__index'] = ($this->elementsIndex--);
66 66
         }
67 67
         $this->elements[$name] = $element;
68 68
 
@@ -135,20 +135,20 @@  discard block
 block discarded – undo
135 135
     protected function childComparator($childA, $childB)
136 136
     {
137 137
         if ($childA->getPosition() < $childB->getPosition()) {
138
-            return - 1;
138
+            return -1;
139 139
         }
140 140
         if ($childA->getPosition() > $childB->getPosition()) {
141 141
             return 1;
142 142
         }
143 143
         if ($childA->get('__index') > $childB->get('__index')) {
144
-            return - 1;
144
+            return -1;
145 145
         }
146 146
         if ($childA->get('__index') < $childB->get('__index')) {
147 147
             return 1;
148 148
         }
149 149
 
150 150
         // if the priority is the same, childB is first
151
-        return - 1;
151
+        return -1;
152 152
     }
153 153
 
154 154
     /**
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
     function getElements()
160 160
     {
161 161
         // first sort the children so they are retrieved by priority
162
-        uasort($this->elements, array( $this, 'childComparator' ));
162
+        uasort($this->elements, array($this, 'childComparator'));
163 163
 
164 164
         return $this->elements;
165 165
     }
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
     {
173 173
         foreach ($this->elements as $element) {
174 174
             $group = $element->getGroup();
175
-            if ($group && ! isset($this->elements[$group])) {
175
+            if ($group && !isset($this->elements[$group])) {
176 176
                 $element->setGroup(null);
177 177
             }
178 178
         }
Please login to merge, or discard this patch.