@@ -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() |
@@ -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 | |
@@ -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 | |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | public function filter() |
| 357 | 357 | { |
| 358 | 358 | $success = $this->filter->apply($this); |
| 359 | - if (! $success) { |
|
| 359 | + if (!$success) { |
|
| 360 | 360 | $this->success = $success; |
| 361 | 361 | $this->failures = $this->filter->getFailures(); |
| 362 | 362 | } |
@@ -364,9 +364,9 @@ discard block |
||
| 364 | 364 | // Iterate on fieldset or collection and get failures |
| 365 | 365 | foreach ($this->inputs as $name => $input) { |
| 366 | 366 | if ($input instanceof Fieldset || $input instanceof Collection) { |
| 367 | - if (! $input->filter()) { |
|
| 367 | + if (!$input->filter()) { |
|
| 368 | 368 | $this->success = false; |
| 369 | - if (! $this->failures instanceof ArrayObject) { |
|
| 369 | + if (!$this->failures instanceof ArrayObject) { |
|
| 370 | 370 | $this->failures = new ArrayObject(); |
| 371 | 371 | } |
| 372 | 372 | $this->failures->offsetSet($name, $input->getFailures()); |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | // If there is no failure, then it is a success on all Filters |
| 378 | - if (! isset($this->success) && $success) { |
|
| 378 | + if (!isset($this->success) && $success) { |
|
| 379 | 379 | $this->success = true; |
| 380 | 380 | } |
| 381 | 381 | |
@@ -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); |