@@ -111,7 +111,7 @@ |
||
111 | 111 | * |
112 | 112 | * Is the current iterator position valid? |
113 | 113 | * |
114 | - * @return void |
|
114 | + * @return boolean |
|
115 | 115 | * |
116 | 116 | */ |
117 | 117 | public function valid() |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * |
108 | 108 | * @param string $name The input name. |
109 | 109 | * |
110 | - * @return mixed The input value. |
|
110 | + * @return AbstractInput The input value. |
|
111 | 111 | * |
112 | 112 | */ |
113 | 113 | public function __get($name) |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | * |
356 | 356 | * Filters the inputs on this fieldset. |
357 | 357 | * |
358 | - * @return bool True if all the filter rules pass, false if not. |
|
358 | + * @return boolean|null True if all the filter rules pass, false if not. |
|
359 | 359 | * |
360 | 360 | */ |
361 | 361 | public function filter() |
@@ -358,46 +358,46 @@ |
||
358 | 358 | * @return bool True if all the filter rules pass, false if not. |
359 | 359 | * |
360 | 360 | */ |
361 | - public function filter() |
|
362 | - { |
|
363 | - $success = $this->filter->apply($this); |
|
364 | - if (! $success) { |
|
365 | - $this->success = $success; |
|
366 | - $this->failures = $this->filter->getFailures(); |
|
367 | - } |
|
368 | - |
|
369 | - // Iterate on fieldset or collection and get failures |
|
370 | - foreach ($this->inputs as $name => $input) { |
|
371 | - if ($input instanceof Fieldset || $input instanceof Collection) { |
|
372 | - if (! $input->filter()) { |
|
373 | - $this->success = false; |
|
374 | - if (! $this->failures instanceof ArrayObject) { |
|
375 | - $this->failures = new ArrayObject(); |
|
376 | - } |
|
377 | - $this->failures->offsetSet($name, $input->getFailures()); |
|
378 | - } |
|
379 | - } |
|
380 | - } |
|
381 | - |
|
382 | - // If there is no failure, then it is a success on all Filters |
|
383 | - if (! isset($this->success) && $success) { |
|
384 | - $this->success = true; |
|
385 | - } |
|
386 | - |
|
387 | - return $this->success; |
|
388 | - } |
|
389 | - |
|
390 | - /** |
|
391 | - * |
|
392 | - * Returns the failures. |
|
393 | - * |
|
394 | - * @return ArrayObject |
|
395 | - * |
|
396 | - */ |
|
397 | - public function getFailures() |
|
398 | - { |
|
399 | - return $this->failures; |
|
400 | - } |
|
361 | + public function filter() |
|
362 | + { |
|
363 | + $success = $this->filter->apply($this); |
|
364 | + if (! $success) { |
|
365 | + $this->success = $success; |
|
366 | + $this->failures = $this->filter->getFailures(); |
|
367 | + } |
|
368 | + |
|
369 | + // Iterate on fieldset or collection and get failures |
|
370 | + foreach ($this->inputs as $name => $input) { |
|
371 | + if ($input instanceof Fieldset || $input instanceof Collection) { |
|
372 | + if (! $input->filter()) { |
|
373 | + $this->success = false; |
|
374 | + if (! $this->failures instanceof ArrayObject) { |
|
375 | + $this->failures = new ArrayObject(); |
|
376 | + } |
|
377 | + $this->failures->offsetSet($name, $input->getFailures()); |
|
378 | + } |
|
379 | + } |
|
380 | + } |
|
381 | + |
|
382 | + // If there is no failure, then it is a success on all Filters |
|
383 | + if (! isset($this->success) && $success) { |
|
384 | + $this->success = true; |
|
385 | + } |
|
386 | + |
|
387 | + return $this->success; |
|
388 | + } |
|
389 | + |
|
390 | + /** |
|
391 | + * |
|
392 | + * Returns the failures. |
|
393 | + * |
|
394 | + * @return ArrayObject |
|
395 | + * |
|
396 | + */ |
|
397 | + public function getFailures() |
|
398 | + { |
|
399 | + return $this->failures; |
|
400 | + } |
|
401 | 401 | |
402 | 402 | /** |
403 | 403 | * |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | */ |
143 | 143 | public function __isset($name) |
144 | 144 | { |
145 | - if (! isset($this->inputs[$name])) { |
|
145 | + if (!isset($this->inputs[$name])) { |
|
146 | 146 | return false; |
147 | 147 | } |
148 | 148 | |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | */ |
189 | 189 | public function getInput($name) |
190 | 190 | { |
191 | - if (! isset($this->inputs[$name])) { |
|
191 | + if (!isset($this->inputs[$name])) { |
|
192 | 192 | throw new Exception\NoSuchInput($name); |
193 | 193 | } |
194 | 194 | |
@@ -338,11 +338,11 @@ discard block |
||
338 | 338 | */ |
339 | 339 | public function get($name = null) |
340 | 340 | { |
341 | - if (! $name) { |
|
341 | + if (!$name) { |
|
342 | 342 | return $this; |
343 | 343 | } |
344 | 344 | |
345 | - if (! isset($this->inputs[$name])) { |
|
345 | + if (!isset($this->inputs[$name])) { |
|
346 | 346 | throw new Exception\NoSuchInput($name); |
347 | 347 | } |
348 | 348 | |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | public function filter() |
362 | 362 | { |
363 | 363 | $success = $this->filter->apply($this); |
364 | - if (! $success) { |
|
364 | + if (!$success) { |
|
365 | 365 | $this->success = $success; |
366 | 366 | $this->failures = $this->filter->getFailures(); |
367 | 367 | } |
@@ -369,9 +369,9 @@ discard block |
||
369 | 369 | // Iterate on fieldset or collection and get failures |
370 | 370 | foreach ($this->inputs as $name => $input) { |
371 | 371 | if ($input instanceof Fieldset || $input instanceof Collection) { |
372 | - if (! $input->filter()) { |
|
372 | + if (!$input->filter()) { |
|
373 | 373 | $this->success = false; |
374 | - if (! $this->failures instanceof ArrayObject) { |
|
374 | + if (!$this->failures instanceof ArrayObject) { |
|
375 | 375 | $this->failures = new ArrayObject(); |
376 | 376 | } |
377 | 377 | $this->failures->offsetSet($name, $input->getFailures()); |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | } |
381 | 381 | |
382 | 382 | // If there is no failure, then it is a success on all Filters |
383 | - if (! isset($this->success) && $success) { |
|
383 | + if (!isset($this->success) && $success) { |
|
384 | 384 | $this->success = true; |
385 | 385 | } |
386 | 386 |
@@ -85,7 +85,7 @@ |
||
85 | 85 | { |
86 | 86 | $passed = true; |
87 | 87 | foreach ($this->fieldsets as $key => $fieldset) { |
88 | - if (! $fieldset->filter()) { |
|
88 | + if (!$fieldset->filter()) { |
|
89 | 89 | $passed = false; |
90 | 90 | } |
91 | 91 | } |
@@ -74,7 +74,7 @@ |
||
74 | 74 | */ |
75 | 75 | public function fill(array $data) |
76 | 76 | { |
77 | - if ($this->anti_csrf && ! $this->anti_csrf->isValid($data)) { |
|
77 | + if ($this->anti_csrf && !$this->anti_csrf->isValid($data)) { |
|
78 | 78 | throw new Exception\CsrfViolation; |
79 | 79 | } |
80 | 80 | parent::fill($data); |
@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | // if the rule did not pass, retain a message for the field. |
102 | 102 | // note that it is in an array, so that other implementations |
103 | 103 | // can allow for multiple messages. |
104 | - if (! $passed) { |
|
105 | - if (! isset($this->messages[$field])) { |
|
104 | + if (!$passed) { |
|
105 | + if (!isset($this->messages[$field])) { |
|
106 | 106 | $this->messages[$field][] = $message; |
107 | 107 | } else { |
108 | 108 | // the message should be first. |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | */ |
141 | 141 | public function addMessages($field, $messages) |
142 | 142 | { |
143 | - if (! isset($this->messages[$field])) { |
|
143 | + if (!isset($this->messages[$field])) { |
|
144 | 144 | $this->messages[$field][] = $messages; |
145 | 145 | } else { |
146 | 146 | $this->messages[$field] = array_merge( |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function newField($name, $type = null) |
75 | 75 | { |
76 | - if (! $type) { |
|
76 | + if (!$type) { |
|
77 | 77 | $type = 'text'; |
78 | 78 | } |
79 | 79 | $class = $this->field_class; |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function newFieldset($name, $type = null) |
97 | 97 | { |
98 | - if (! $type) { |
|
98 | + if (!$type) { |
|
99 | 99 | $type = $name; |
100 | 100 | } |
101 | 101 | $factory = $this->fieldset_map[$type]; |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | */ |
118 | 118 | public function newCollection($name, $type = null) |
119 | 119 | { |
120 | - if (! $type) { |
|
120 | + if (!$type) { |
|
121 | 121 | $type = $name; |
122 | 122 | } |
123 | 123 | $class = $this->collection_class; |
@@ -55,7 +55,7 @@ |
||
55 | 55 | */ |
56 | 56 | public function newInstance($name) |
57 | 57 | { |
58 | - if (! isset($this->map[$name])) { |
|
58 | + if (!isset($this->map[$name])) { |
|
59 | 59 | throw new Exception\NoSuchForm($name); |
60 | 60 | } |
61 | 61 |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | error_reporting(E_ALL); |
3 | 3 | $autoloader = __DIR__ . '/vendor/autoload.php'; |
4 | -if (! file_exists($autoloader)) { |
|
4 | +if (!file_exists($autoloader)) { |
|
5 | 5 | echo "Composer autoloader not found: $autoloader" . PHP_EOL; |
6 | 6 | echo "Please issue 'composer install' and try again." . PHP_EOL; |
7 | 7 | exit(1); |