@@ -29,7 +29,7 @@ |
||
29 | 29 | public function setPath() |
30 | 30 | { |
31 | 31 | $reflector = new \ReflectionClass($this); |
32 | - $this->path = dirname($reflector->getFileName());; |
|
32 | + $this->path = dirname($reflector->getFileName()); ; |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
@@ -471,7 +471,7 @@ |
||
471 | 471 | |
472 | 472 | // Work out the argument names of the requested method |
473 | 473 | $method = new \ReflectionMethod($this, $name); |
474 | - foreach($method->getParameters() as $arg) { |
|
474 | + foreach ($method->getParameters() as $arg) { |
|
475 | 475 | $args[] = $arg->getName(); |
476 | 476 | } |
477 | 477 |
@@ -26,7 +26,7 @@ |
||
26 | 26 | |
27 | 27 | public function getProperties() |
28 | 28 | { |
29 | - return [ 'name_first' => $this->name.'_first', |
|
29 | + return ['name_first' => $this->name.'_first', |
|
30 | 30 | 'name_surname' => $this->name.'_surname', |
31 | 31 | 'value_first' => $this->value_first, |
32 | 32 | 'value_surname' => $this->value_surname, |
@@ -28,13 +28,13 @@ |
||
28 | 28 | |
29 | 29 | public function alphaNum($var) |
30 | 30 | { |
31 | - if (! is_string($var) && ! is_numeric($var)) return false; |
|
31 | + if ( ! is_string($var) && ! is_numeric($var)) return false; |
|
32 | 32 | return preg_match('/^[\pL\pM\pN]+$/u', $var); |
33 | 33 | } |
34 | 34 | |
35 | 35 | public function alphaDash($var) |
36 | 36 | { |
37 | - if (! is_string($var) && ! is_numeric($var)) return false; |
|
37 | + if ( ! is_string($var) && ! is_numeric($var)) return false; |
|
38 | 38 | return preg_match('/^[\pL\pM\pN_-]+$/u', $var); |
39 | 39 | } |
40 | 40 |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | */ |
358 | 358 | public function completed($name = null) |
359 | 359 | { |
360 | - if($this->submitted($name) && $this->valid()) { |
|
360 | + if ($this->submitted($name) && $this->valid()) { |
|
361 | 361 | $this->broadcast('completed'); |
362 | 362 | return true; |
363 | 363 | } |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | $errors = []; |
498 | 498 | |
499 | 499 | foreach ($this->fields as $field) { |
500 | - foreach($field->errors() as $error) { |
|
500 | + foreach ($field->errors() as $error) { |
|
501 | 501 | $errors[] = $error; |
502 | 502 | } |
503 | 503 | } |
@@ -619,8 +619,8 @@ discard block |
||
619 | 619 | { |
620 | 620 | $config = $this->templateConfig($template); |
621 | 621 | |
622 | - if ( isset($config['plugins']) && is_array($config['plugins'])) { |
|
623 | - foreach($config['plugins'] as $plugin) { |
|
622 | + if (isset($config['plugins']) && is_array($config['plugins'])) { |
|
623 | + foreach ($config['plugins'] as $plugin) { |
|
624 | 624 | $this->addPlugin($plugin); |
625 | 625 | } |
626 | 626 | } |
@@ -636,8 +636,8 @@ discard block |
||
636 | 636 | { |
637 | 637 | $config = $this->templateConfig($template); |
638 | 638 | |
639 | - if ( isset($config['plugins']) && is_array($config['plugins'])) { |
|
640 | - foreach($config['plugins'] as $plugin) { |
|
639 | + if (isset($config['plugins']) && is_array($config['plugins'])) { |
|
640 | + foreach ($config['plugins'] as $plugin) { |
|
641 | 641 | $this->removePlugin($plugin); |
642 | 642 | } |
643 | 643 | } |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | foreach ($field->errors() as $error => $parameters) { |
675 | 675 | |
676 | 676 | if ($error == 'userDefined') { |
677 | - foreach($parameters as $message) { |
|
677 | + foreach ($parameters as $message) { |
|
678 | 678 | $properties['errors'][] = ['error' => $message]; |
679 | 679 | } |
680 | 680 | } else { |
@@ -683,7 +683,7 @@ discard block |
||
683 | 683 | |
684 | 684 | $message = $this->translate($error, $field); |
685 | 685 | |
686 | - foreach($parameters as $key => $value) { |
|
686 | + foreach ($parameters as $key => $value) { |
|
687 | 687 | if (is_object($value) && method_exists($value, '__toString')) $value = (string) $value; |
688 | 688 | if (is_array($value)) $value = implode(', ', $value); |
689 | 689 | $message = str_replace('['.$key.']', $value, $message); |
@@ -930,7 +930,7 @@ discard block |
||
930 | 930 | */ |
931 | 931 | private function broadcast($event, $params = []) |
932 | 932 | { |
933 | - foreach($this->plugins as $plugin) { |
|
933 | + foreach ($this->plugins as $plugin) { |
|
934 | 934 | $plugin->event($this, $event, $params); |
935 | 935 | } |
936 | 936 | } |
@@ -1078,7 +1078,7 @@ discard block |
||
1078 | 1078 | { |
1079 | 1079 | if ( ! method_exists($this, $method)) |
1080 | 1080 | { |
1081 | - if ( $this->typeExists($method)) { |
|
1081 | + if ($this->typeExists($method)) { |
|
1082 | 1082 | return $this->addField($method, array_shift($parameters)); |
1083 | 1083 | } |
1084 | 1084 | } |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | //use Helmut\Forms\Testing\Stubs\Form; |
6 | 6 | |
7 | -class FormTestCase extends \PHPUnit_Framework_TestCase{ |
|
7 | +class FormTestCase extends \PHPUnit_Framework_TestCase { |
|
8 | 8 | |
9 | 9 | public function request() |
10 | 10 | { |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | return $request; |
14 | 14 | } |
15 | 15 | |
16 | - public function form($request=null) |
|
16 | + public function form($request = null) |
|
17 | 17 | { |
18 | 18 | if ( ! $request) $request = $this->request(); |
19 | 19 |
@@ -151,22 +151,22 @@ |
||
151 | 151 | public function it_validates_in() |
152 | 152 | { |
153 | 153 | $this->assertValid(function($form) { $form->text('foo')->in(); }); |
154 | - $this->assertValid(function($form) { $form->text('foo')->in(['a', 'b','c']); }); |
|
155 | - $this->assertValid(function($form) { $form->text('foo')->in(['a', 'b','c'])->default('a'); }); |
|
154 | + $this->assertValid(function($form) { $form->text('foo')->in(['a', 'b', 'c']); }); |
|
155 | + $this->assertValid(function($form) { $form->text('foo')->in(['a', 'b', 'c'])->default('a'); }); |
|
156 | 156 | |
157 | - $this->assertNotValid(function($form) { $form->text('foo')->in(['a', 'b','c'])->required(); }); |
|
158 | - $this->assertNotValid(function($form) { $form->text('foo')->in(['a', 'b','c'])->default('d'); }); |
|
157 | + $this->assertNotValid(function($form) { $form->text('foo')->in(['a', 'b', 'c'])->required(); }); |
|
158 | + $this->assertNotValid(function($form) { $form->text('foo')->in(['a', 'b', 'c'])->default('d'); }); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | /** @test */ |
162 | 162 | public function it_validates_not_in() |
163 | 163 | { |
164 | 164 | $this->assertValid(function($form) { $form->text('foo')->not_in(); }); |
165 | - $this->assertValid(function($form) { $form->text('foo')->not_in(['a', 'b','c']); }); |
|
166 | - $this->assertValid(function($form) { $form->text('foo')->not_in(['a', 'b','c'])->default('d'); }); |
|
165 | + $this->assertValid(function($form) { $form->text('foo')->not_in(['a', 'b', 'c']); }); |
|
166 | + $this->assertValid(function($form) { $form->text('foo')->not_in(['a', 'b', 'c'])->default('d'); }); |
|
167 | 167 | |
168 | - $this->assertNotValid(function($form) { $form->text('foo')->not_in(['a', 'b','c'])->required(); }); |
|
169 | - $this->assertNotValid(function($form) { $form->text('foo')->not_in(['a', 'b','c'])->default('a'); }); |
|
168 | + $this->assertNotValid(function($form) { $form->text('foo')->not_in(['a', 'b', 'c'])->required(); }); |
|
169 | + $this->assertNotValid(function($form) { $form->text('foo')->not_in(['a', 'b', 'c'])->default('a'); }); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | } |
@@ -130,7 +130,7 @@ |
||
130 | 130 | |
131 | 131 | $this->assertNotValid(function($form) { $form->number('foo')->integer()->required(); }); |
132 | 132 | $this->assertNotValid(function($form) { $form->number('foo')->integer()->default(10.3); }); |
133 | - $this->assertNotValid(function($form) { $form->number('foo')->integer()->default(1/3); }); |
|
133 | + $this->assertNotValid(function($form) { $form->number('foo')->integer()->default(1 / 3); }); |
|
134 | 134 | $this->assertNotValid(function($form) { $form->number('foo')->integer()->default('10.2'); }); |
135 | 135 | } |
136 | 136 |
@@ -2,6 +2,6 @@ |
||
2 | 2 | |
3 | 3 | require '../_includes.php'; |
4 | 4 | |
5 | -$form->checkboxes('foo')->label('bar')->options(['a'=>'A','b'=>'B', 'c'=>'C'])->checked(); |
|
5 | +$form->checkboxes('foo')->label('bar')->options(['a'=>'A', 'b'=>'B', 'c'=>'C'])->checked(); |
|
6 | 6 | |
7 | 7 | require '../_view.php'; |
8 | 8 | \ No newline at end of file |