@@ -27,11 +27,11 @@ |
||
| 27 | 27 | |
| 28 | 28 | protected function _validate() |
| 29 | 29 | { |
| 30 | - if(!is_scalar($this->value)) { |
|
| 30 | + if (!is_scalar($this->value)) { |
|
| 31 | 31 | return null; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - if(preg_match('/\A[a-zA-Z]+\z/', $this->value)) { |
|
| 34 | + if (preg_match('/\A[a-zA-Z]+\z/', $this->value)) { |
|
| 35 | 35 | return $this->value; |
| 36 | 36 | } |
| 37 | 37 | |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | array_unshift($args, $this->value); |
| 35 | 35 | |
| 36 | 36 | $result = call_user_func_array($this->getOption('callback'), $args); |
| 37 | - if($result !== false) { |
|
| 37 | + if ($result !== false) { |
|
| 38 | 38 | return $this->value; |
| 39 | 39 | } |
| 40 | 40 | |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | |
| 31 | 31 | protected function _validate() |
| 32 | 32 | { |
| 33 | - if(ConvertHelper::isInteger($this->value)) { |
|
| 33 | + if (ConvertHelper::isInteger($this->value)) { |
|
| 34 | 34 | return intval($this->value); |
| 35 | 35 | } |
| 36 | 36 | |
@@ -27,12 +27,12 @@ |
||
| 27 | 27 | |
| 28 | 28 | protected function _validate() |
| 29 | 29 | { |
| 30 | - if(!is_string($this->value)) { |
|
| 30 | + if (!is_string($this->value)) { |
|
| 31 | 31 | return ''; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | $info = parseURL($this->value); |
| 35 | - if($info->isValid()) { |
|
| 35 | + if ($info->isValid()) { |
|
| 36 | 36 | return $this->value; |
| 37 | 37 | } |
| 38 | 38 | |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | |
| 28 | 28 | protected function _validate() |
| 29 | 29 | { |
| 30 | - if(is_numeric($this->value)) { |
|
| 30 | + if (is_numeric($this->value)) { |
|
| 31 | 31 | return $this->value * 1; |
| 32 | 32 | } |
| 33 | 33 | |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | |
| 28 | 28 | protected function _validate() |
| 29 | 29 | { |
| 30 | - if(is_array($this->value)) { |
|
| 30 | + if (is_array($this->value)) { |
|
| 31 | 31 | return $this->value; |
| 32 | 32 | } |
| 33 | 33 | |
@@ -29,13 +29,13 @@ |
||
| 29 | 29 | |
| 30 | 30 | protected function _validate() |
| 31 | 31 | { |
| 32 | - if(!is_array($this->value)) { |
|
| 32 | + if (!is_array($this->value)) { |
|
| 33 | 33 | return array(); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | $keep = array(); |
| 37 | - foreach($this->value as $item) { |
|
| 38 | - if(in_array($item, $this->getArrayOption('values'))) { |
|
| 37 | + foreach ($this->value as $item) { |
|
| 38 | + if (in_array($item, $this->getArrayOption('values'))) { |
|
| 39 | 39 | $keep[] = $item; |
| 40 | 40 | } |
| 41 | 41 | } |
@@ -29,26 +29,26 @@ |
||
| 29 | 29 | |
| 30 | 30 | protected function _validate() |
| 31 | 31 | { |
| 32 | - if(!is_string($this->value)) { |
|
| 32 | + if (!is_string($this->value)) { |
|
| 33 | 33 | return ''; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | $value = trim($this->value); |
| 37 | 37 | |
| 38 | - if(empty($value)) { |
|
| 38 | + if (empty($value)) { |
|
| 39 | 39 | return ''; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | // strictly validate for objects? |
| 43 | - if($this->getBoolOption('arrays') === false) |
|
| 43 | + if ($this->getBoolOption('arrays') === false) |
|
| 44 | 44 | { |
| 45 | - if(is_object(json_decode($value))) { |
|
| 45 | + if (is_object(json_decode($value))) { |
|
| 46 | 46 | return $value; |
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | else |
| 50 | 50 | { |
| 51 | - if(is_array(json_decode($value, true))) { |
|
| 51 | + if (is_array(json_decode($value, true))) { |
|
| 52 | 52 | return $value; |
| 53 | 53 | } |
| 54 | 54 | } |
@@ -45,8 +45,7 @@ |
||
| 45 | 45 | if(is_object(json_decode($value))) { |
| 46 | 46 | return $value; |
| 47 | 47 | } |
| 48 | - } |
|
| 49 | - else |
|
| 48 | + } else |
|
| 50 | 49 | { |
| 51 | 50 | if(is_array(json_decode($value, true))) { |
| 52 | 51 | return $value; |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | protected function _validate() |
| 29 | 29 | { |
| 30 | - if(!is_scalar($this->value)) { |
|
| 30 | + if (!is_scalar($this->value)) { |
|
| 31 | 31 | return null; |
| 32 | 32 | } |
| 33 | 33 | |
@@ -35,13 +35,13 @@ discard block |
||
| 35 | 35 | // is a boolan, which is converted to an integer when |
| 36 | 36 | // converted to string, which in turn can be validated |
| 37 | 37 | // with a regex. |
| 38 | - if(is_bool($this->value)) { |
|
| 38 | + if (is_bool($this->value)) { |
|
| 39 | 39 | return null; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | $value = (string)$this->value; |
| 43 | 43 | |
| 44 | - if(preg_match($this->getStringOption('regex'), $value)) { |
|
| 44 | + if (preg_match($this->getStringOption('regex'), $value)) { |
|
| 45 | 45 | return $value; |
| 46 | 46 | } |
| 47 | 47 | |