@@ -55,7 +55,9 @@ |
||
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | protected function isIntValue($value){ |
| 58 | - if(is_bool($value)) return false; |
|
| 58 | + if(is_bool($value)) { |
|
| 59 | + return false; |
|
| 60 | + } |
|
| 59 | 61 | return is_int($value) || preg_match('/^\d+$/',$value); |
| 60 | 62 | } |
| 61 | 63 | |
@@ -22,7 +22,9 @@ |
||
| 22 | 22 | public function __construct($value, $type = null) |
| 23 | 23 | { |
| 24 | 24 | $this->value = $value; |
| 25 | - if(!in_array($type, $this->types())) throw new ValueObjectInvalidTypeException('Wrong type: '. $type); |
|
| 25 | + if(!in_array($type, $this->types())) { |
|
| 26 | + throw new ValueObjectInvalidTypeException('Wrong type: '. $type); |
|
| 27 | + } |
|
| 26 | 28 | $this->type = $type; |
| 27 | 29 | } |
| 28 | 30 | |
@@ -23,7 +23,9 @@ |
||
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | protected function isIntValue($value){ |
| 26 | - if(is_bool($value)) return false; |
|
| 26 | + if(is_bool($value)) { |
|
| 27 | + return false; |
|
| 28 | + } |
|
| 27 | 29 | return is_int($value) || preg_match('/^\d+$/',$value); |
| 28 | 30 | } |
| 29 | 31 | } |
| 30 | 32 | \ No newline at end of file |
@@ -18,7 +18,9 @@ |
||
| 18 | 18 | $this->closure = $closure; |
| 19 | 19 | } |
| 20 | 20 | public function check($data){ |
| 21 | - if (! $data instanceof ValueObject) $data = ValueObject::get($data); |
|
| 21 | + if (! $data instanceof ValueObject) { |
|
| 22 | + $data = ValueObject::get($data); |
|
| 23 | + } |
|
| 22 | 24 | try { |
| 23 | 25 | return call_user_func($this->closure,$data); |
| 24 | 26 | } catch (\Exception $exception){ |