@@ -17,7 +17,7 @@ |
||
17 | 17 | class CheckboxList extends \Fiv\Form\Element\Multiple { |
18 | 18 | |
19 | 19 | /** |
20 | - * @param array|string $data |
|
20 | + * @param string[] $data |
|
21 | 21 | * @return $this |
22 | 22 | */ |
23 | 23 | public function setValue($data) { |
@@ -61,14 +61,14 @@ |
||
61 | 61 | |
62 | 62 | foreach ($this->options as $value => $text) { |
63 | 63 | $attributes['value'] = $value; |
64 | - $attributes['name'] = $name . '[]'; |
|
64 | + $attributes['name'] = $name.'[]'; |
|
65 | 65 | if (in_array($value, $currentValues)) { |
66 | 66 | $attributes['checked'] = 'checked'; |
67 | 67 | } else { |
68 | 68 | unset($attributes['checked']); |
69 | 69 | } |
70 | 70 | |
71 | - $html .= '<label>' . static::tag('input', $attributes) . $text . '</label>'; |
|
71 | + $html .= '<label>'.static::tag('input', $attributes).$text.'</label>'; |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | return $html; |
@@ -58,4 +58,4 @@ |
||
58 | 58 | } |
59 | 59 | |
60 | 60 | } |
61 | - |
|
62 | 61 | \ No newline at end of file |
62 | + |
|
63 | 63 | \ No newline at end of file |
@@ -214,7 +214,7 @@ |
||
214 | 214 | |
215 | 215 | $checkedItemsNum = 0; |
216 | 216 | |
217 | - $element->addValidator(new CallBackValidator(function ($value) use (&$checkedItemsNum) { |
|
217 | + $element->addValidator(new CallBackValidator(function($value) use (&$checkedItemsNum) { |
|
218 | 218 | $checkedItemsNum++; |
219 | 219 | |
220 | 220 | return !empty($value); |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | class CallBackValidatorTest extends \PHPUnit_Framework_TestCase { |
12 | 12 | |
13 | 13 | public function testLen() { |
14 | - $lengthValidator = new CallBackValidator(function ($value) { |
|
14 | + $lengthValidator = new CallBackValidator(function($value) { |
|
15 | 15 | return strlen($value) > 3 and strlen($value) < 10; |
16 | 16 | }); |
17 | 17 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | '[email protected]', |
54 | 54 | ]; |
55 | 55 | |
56 | - $callBackValidator = (new CallBackValidator(function ($value) use ($existEmailList) { |
|
56 | + $callBackValidator = (new CallBackValidator(function($value) use ($existEmailList) { |
|
57 | 57 | if (empty($value)) { |
58 | 58 | return true; |
59 | 59 | } |
@@ -12,7 +12,7 @@ |
||
12 | 12 | * @author Ivan Shcherbak <[email protected]> |
13 | 13 | * @package Fiv\Form\Validator |
14 | 14 | */ |
15 | - class Len extends BaseValidator{ |
|
15 | + class Len extends BaseValidator { |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * @var int|null |
@@ -6,7 +6,7 @@ |
||
6 | 6 | * @author Ivan Shcherbak <[email protected]> |
7 | 7 | * @package Fiv\Form\Filter |
8 | 8 | */ |
9 | - class Trim implements FilterInterface{ |
|
9 | + class Trim implements FilterInterface { |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * @inheritdoc |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | |
57 | 57 | /** |
58 | - * @param $name |
|
58 | + * @param string $name |
|
59 | 59 | * @return $this |
60 | 60 | */ |
61 | 61 | public function setName($name) { |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | |
300 | 300 | /** |
301 | 301 | * @param string $name |
302 | - * @param null $text |
|
302 | + * @param string $text |
|
303 | 303 | * @return TextArea |
304 | 304 | */ |
305 | 305 | public function textarea($name, $text = null) { |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | * $form->hidden('key', md5($this-user->id . HASH_A); |
317 | 317 | * ``` |
318 | 318 | * @param string $name |
319 | - * @param null $value |
|
319 | + * @param string $value |
|
320 | 320 | * @return \Fiv\Form\Element\Input |
321 | 321 | */ |
322 | 322 | public function hidden($name, $value = null) { |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | * $form->submit('register', 'зареєструватись'); |
335 | 335 | * ``` |
336 | 336 | * @param string $name |
337 | - * @param null $value |
|
337 | + * @param string $value |
|
338 | 338 | * @return Submit |
339 | 339 | */ |
340 | 340 | public function submit($name, $value = null) { |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | */ |
189 | 189 | protected function addError($error) { |
190 | 190 | if (!is_string($error)) { |
191 | - throw new \InvalidArgumentException('Error should be a string, ' . gettype($error) . ' given.'); |
|
191 | + throw new \InvalidArgumentException('Error should be a string, '.gettype($error).' given.'); |
|
192 | 192 | } |
193 | 193 | $this->validationResult = false; |
194 | 194 | $this->errorList[] = $error; |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | */ |
236 | 236 | public function getElement($name) { |
237 | 237 | if (empty($this->elements[$name])) { |
238 | - throw new \InvalidArgumentException('Element with name "' . $name . '" not found'); |
|
238 | + throw new \InvalidArgumentException('Element with name "'.$name.'" not found'); |
|
239 | 239 | } |
240 | 240 | return $this->elements[$name]; |
241 | 241 | } |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | */ |
398 | 398 | public function addElement(Element\BaseElement $element) { |
399 | 399 | if (isset($this->elements[$element->getName()])) { |
400 | - throw new \Exception('Element with name ' . $element->getName() . ' is already added. Use setElement to overwrite it or change name'); |
|
400 | + throw new \Exception('Element with name '.$element->getName().' is already added. Use setElement to overwrite it or change name'); |
|
401 | 401 | } |
402 | 402 | |
403 | 403 | $this->cleanValidationFlag(); |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | * @return string |
413 | 413 | */ |
414 | 414 | public function render() { |
415 | - return $this->renderStart() . $this->renderElements() . $this->renderEnd(); |
|
415 | + return $this->renderStart().$this->renderElements().$this->renderEnd(); |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | |
@@ -431,8 +431,8 @@ discard block |
||
431 | 431 | } |
432 | 432 | |
433 | 433 | $formHtml .= |
434 | - '<dt>' . $element->getText() . '</dt>' . |
|
435 | - '<dd>' . $element->render() . '</dd>'; |
|
434 | + '<dt>'.$element->getText().'</dt>'. |
|
435 | + '<dd>'.$element->render().'</dd>'; |
|
436 | 436 | } |
437 | 437 | |
438 | 438 | $formHtml .= '</dl>'; |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | $method = $this->getMethod(); |
457 | 457 | $this->setAttribute('method', $method); |
458 | 458 | |
459 | - $html = '<form ' . Element\Html::renderAttributes($this->getAttributes()) . '>'; |
|
459 | + $html = '<form '.Element\Html::renderAttributes($this->getAttributes()).'>'; |
|
460 | 460 | $html .= $hidden->render(); |
461 | 461 | |
462 | 462 | # render hidden element |
@@ -14,13 +14,13 @@ |
||
14 | 14 | * @return string |
15 | 15 | */ |
16 | 16 | public function render() { |
17 | - $html = '<select ' . Html::renderAttributes($this->getAttributes()) . ' >'; |
|
17 | + $html = '<select '.Html::renderAttributes($this->getAttributes()).' >'; |
|
18 | 18 | $currentValue = $this->getValue(); |
19 | 19 | |
20 | 20 | foreach ($this->options as $value => $text) { |
21 | 21 | $html .= '<option' |
22 | 22 | . ($currentValue == $value ? ' selected="1" ' : '') |
23 | - . ' value="' . $value . '"' |
|
23 | + . ' value="'.$value.'"' |
|
24 | 24 | . '>' |
25 | 25 | . $text |
26 | 26 | . '</option>'; |
@@ -27,7 +27,7 @@ |
||
27 | 27 | unset($attributes['checked']); |
28 | 28 | } |
29 | 29 | |
30 | - $html .= '<label>' . static::tag('input', $attributes) . $text . '</label>'; |
|
30 | + $html .= '<label>'.static::tag('input', $attributes).$text.'</label>'; |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | return $html; |