@@ -2,7 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | /** |
| 4 | 4 | * @param $name |
| 5 | - * @param array $args |
|
| 6 | 5 | * @return \Comfort\Comfort |
| 7 | 6 | */ |
| 8 | 7 | function cmf() |
@@ -2,7 +2,6 @@ |
||
| 2 | 2 | namespace Comfort\Validator; |
| 3 | 3 | |
| 4 | 4 | use Comfort\Comfort; |
| 5 | -use Comfort\Validator\StringValidator\UriMethod; |
|
| 6 | 5 | |
| 7 | 6 | class StringValidator extends AbstractValidator |
| 8 | 7 | { |
@@ -170,7 +170,7 @@ |
||
| 170 | 170 | */ |
| 171 | 171 | public function uri(array $options = []) |
| 172 | 172 | { |
| 173 | - return $this->add(function ($value, $nameKey) use($options) { |
|
| 173 | + return $this->add(function($value, $nameKey) use($options) { |
|
| 174 | 174 | if (!filter_var($value, FILTER_VALIDATE_URL)) { |
| 175 | 175 | return $this->createError('string.uri', $value, $nameKey); |
| 176 | 176 | } |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | */ |
| 25 | 25 | public function __call($name, $arguments) |
| 26 | 26 | { |
| 27 | - switch($name) { |
|
| 27 | + switch ($name) { |
|
| 28 | 28 | case 'array': |
| 29 | 29 | return new ArrayValidator($this); |
| 30 | 30 | case 'string': |
@@ -19,8 +19,9 @@ |
||
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | $method = 'set' . ucfirst($option); |
| 22 | - if (!method_exists($this, $method)) |
|
| 23 | - throw new \InvalidArgumentException('Option ' . $optionName . ' is not accepted'); |
|
| 22 | + if (!method_exists($this, $method)) { |
|
| 23 | + throw new \InvalidArgumentException('Option ' . $optionName . ' is not accepted'); |
|
| 24 | + } |
|
| 24 | 25 | |
| 25 | 26 | call_user_func(array($this, $method), $value); |
| 26 | 27 | } |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | |
| 24 | 24 | try { |
| 25 | 25 | $url = $parser->parseUrl($value); |
| 26 | - }catch(\InvalidArgumentException $e) { |
|
| 26 | + }catch (\InvalidArgumentException $e) { |
|
| 27 | 27 | return false; |
| 28 | 28 | } |
| 29 | 29 | |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | |
| 24 | 24 | try { |
| 25 | 25 | $url = $parser->parseUrl($value); |
| 26 | - }catch(\InvalidArgumentException $e) { |
|
| 26 | + } catch(\InvalidArgumentException $e) { |
|
| 27 | 27 | return false; |
| 28 | 28 | } |
| 29 | 29 | |
@@ -62,10 +62,10 @@ |
||
| 62 | 62 | */ |
| 63 | 63 | public function timestamp() |
| 64 | 64 | { |
| 65 | - return $this->add(function ($value, $nameKey) { |
|
| 65 | + return $this->add(function($value, $nameKey) { |
|
| 66 | 66 | try { |
| 67 | 67 | new \DateTime('@' . $value); |
| 68 | - }catch(\Exception $e) { |
|
| 68 | + }catch (\Exception $e) { |
|
| 69 | 69 | return $this->createError('date.timestamp', $value, $nameKey); |
| 70 | 70 | } |
| 71 | 71 | }); |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | return $this->add(function ($value, $nameKey) { |
| 66 | 66 | try { |
| 67 | 67 | new \DateTime('@' . $value); |
| 68 | - }catch(\Exception $e) { |
|
| 68 | + } catch(\Exception $e) { |
|
| 69 | 69 | return $this->createError('date.timestamp', $value, $nameKey); |
| 70 | 70 | } |
| 71 | 71 | }); |
@@ -72,7 +72,7 @@ |
||
| 72 | 72 | } while (next($this->validationStack)); |
| 73 | 73 | |
| 74 | 74 | return $value; |
| 75 | - }catch(ValidationException $validationException) { |
|
| 75 | + }catch (ValidationException $validationException) { |
|
| 76 | 76 | if ($this->toBool) { |
| 77 | 77 | return false; |
| 78 | 78 | } |
@@ -72,7 +72,7 @@ |
||
| 72 | 72 | } while (next($this->validationStack)); |
| 73 | 73 | |
| 74 | 74 | return $value; |
| 75 | - }catch(ValidationException $validationException) { |
|
| 75 | + } catch(ValidationException $validationException) { |
|
| 76 | 76 | if ($this->toBool) { |
| 77 | 77 | return false; |
| 78 | 78 | } |