@@ -126,9 +126,9 @@ discard block |
||
| 126 | 126 | * @param array $args |
| 127 | 127 | * @return Request_Param |
| 128 | 128 | */ |
| 129 | - public function setCallback($callback, array $args=array()) : Request_Param |
|
| 129 | + public function setCallback($callback, array $args = array()) : Request_Param |
|
| 130 | 130 | { |
| 131 | - if(!is_callable($callback)) { |
|
| 131 | + if (!is_callable($callback)) { |
|
| 132 | 132 | throw new Request_Exception( |
| 133 | 133 | 'Not a valid callback', |
| 134 | 134 | 'The specified callback is not a valid callable entity.', |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | |
| 162 | 162 | // go through all enqueued validations in turn, each time |
| 163 | 163 | // replacing the value with the adjusted, validated value. |
| 164 | - foreach($this->validations as $validateDef) |
|
| 164 | + foreach ($this->validations as $validateDef) |
|
| 165 | 165 | { |
| 166 | 166 | $value = $this->validateType($value, $validateDef['type'], $validateDef['params']); |
| 167 | 167 | } |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | { |
| 184 | 184 | $class = '\AppUtils\Request_Param_Validator_'.ucfirst($type); |
| 185 | 185 | |
| 186 | - if(!class_exists($class)) |
|
| 186 | + if (!class_exists($class)) |
|
| 187 | 187 | { |
| 188 | 188 | throw new Request_Exception( |
| 189 | 189 | 'Unknown validation type.', |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | $validator = new $class($this); |
| 200 | 200 | $validator->setOptions($params); |
| 201 | 201 | |
| 202 | - if($this->valueType === self::VALUE_TYPE_ID_LIST) |
|
| 202 | + if ($this->valueType === self::VALUE_TYPE_ID_LIST) |
|
| 203 | 203 | { |
| 204 | 204 | $value = $this->validateType_idList($value, $validator); |
| 205 | 205 | } |
@@ -213,19 +213,19 @@ discard block |
||
| 213 | 213 | |
| 214 | 214 | protected function validateType_idList($value, Request_Param_Validator $validator) : array |
| 215 | 215 | { |
| 216 | - if(!is_array($value)) |
|
| 216 | + if (!is_array($value)) |
|
| 217 | 217 | { |
| 218 | 218 | $value = explode(',', $value); |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | $keep = array(); |
| 222 | 222 | |
| 223 | - foreach($value as $subval) |
|
| 223 | + foreach ($value as $subval) |
|
| 224 | 224 | { |
| 225 | 225 | $subval = trim($subval); |
| 226 | 226 | $subval = $validator->validate($subval); |
| 227 | 227 | |
| 228 | - if($subval !== null) { |
|
| 228 | + if ($subval !== null) { |
|
| 229 | 229 | $keep[] = intval($subval); |
| 230 | 230 | } |
| 231 | 231 | } |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | { |
| 366 | 366 | $args = func_get_args(); // cannot be used as function parameter in some PHP versions |
| 367 | 367 | |
| 368 | - if(is_array($args[0])) |
|
| 368 | + if (is_array($args[0])) |
|
| 369 | 369 | { |
| 370 | 370 | $args = $args[0]; |
| 371 | 371 | } |
@@ -500,10 +500,10 @@ discard block |
||
| 500 | 500 | * @param mixed $default |
| 501 | 501 | * @return mixed |
| 502 | 502 | */ |
| 503 | - public function get($default=null) |
|
| 503 | + public function get($default = null) |
|
| 504 | 504 | { |
| 505 | 505 | $value = $this->request->getParam($this->paramName); |
| 506 | - if($value !== null && $value !== '') { |
|
| 506 | + if ($value !== null && $value !== '') { |
|
| 507 | 507 | return $value; |
| 508 | 508 | } |
| 509 | 509 | |
@@ -522,7 +522,7 @@ discard block |
||
| 522 | 522 | { |
| 523 | 523 | $total = count($this->filters); |
| 524 | 524 | for ($i = 0; $i < $total; $i++) { |
| 525 | - $method = 'applyFilter_' . $this->filters[$i]['type']; |
|
| 525 | + $method = 'applyFilter_'.$this->filters[$i]['type']; |
|
| 526 | 526 | $value = $this->$method($value, $this->filters[$i]['params']); |
| 527 | 527 | } |
| 528 | 528 | |
@@ -679,7 +679,7 @@ discard block |
||
| 679 | 679 | * @param bool $stripEmptyEntries Remove empty entries from the array? |
| 680 | 680 | * @return \AppUtils\Request_Param |
| 681 | 681 | */ |
| 682 | - public function addCommaSeparatedFilter(bool $trimEntries=true, bool $stripEmptyEntries=true) : Request_Param |
|
| 682 | + public function addCommaSeparatedFilter(bool $trimEntries = true, bool $stripEmptyEntries = true) : Request_Param |
|
| 683 | 683 | { |
| 684 | 684 | $this->setArray(); |
| 685 | 685 | |
@@ -692,7 +692,7 @@ discard block |
||
| 692 | 692 | ); |
| 693 | 693 | } |
| 694 | 694 | |
| 695 | - protected function addClassFilter(string $name, array $params=array()) : Request_Param |
|
| 695 | + protected function addClassFilter(string $name, array $params = array()) : Request_Param |
|
| 696 | 696 | { |
| 697 | 697 | return $this->addFilter( |
| 698 | 698 | self::FILTER_TYPE_CLASS, |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | str_replace(' ', '-', $this->type) |
| 41 | 41 | ); |
| 42 | 42 | |
| 43 | - if($this->info->getBoolOption('prepend-type') && !$this->info->isNull()) |
|
| 43 | + if ($this->info->getBoolOption('prepend-type') && !$this->info->isNull()) |
|
| 44 | 44 | { |
| 45 | 45 | $typeLabel = '<span style="color:#1c2eb1" class="variable-type">'.$this->info->getType().'</span> '; |
| 46 | 46 | $converted = $typeLabel.' '.$converted; |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | { |
| 11 | 11 | $string = ''; |
| 12 | 12 | |
| 13 | - if(is_string($this->value[0])) |
|
| 13 | + if (is_string($this->value[0])) |
|
| 14 | 14 | { |
| 15 | 15 | $string .= $this->value[0].'::'; |
| 16 | 16 | } |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | { |
| 11 | 11 | $result = array(); |
| 12 | 12 | |
| 13 | - foreach($this->value as $key => $val) |
|
| 13 | + foreach ($this->value as $key => $val) |
|
| 14 | 14 | { |
| 15 | 15 | $result[$key] = parseVariable($val)->toString(); |
| 16 | 16 | } |
@@ -38,9 +38,9 @@ discard block |
||
| 38 | 38 | * @param mixed $value |
| 39 | 39 | * @param array|null $serialized |
| 40 | 40 | */ |
| 41 | - public function __construct($value, $serialized=null) |
|
| 41 | + public function __construct($value, $serialized = null) |
|
| 42 | 42 | { |
| 43 | - if(is_array($serialized)) |
|
| 43 | + if (is_array($serialized)) |
|
| 44 | 44 | { |
| 45 | 45 | $this->parseSerialized($serialized); |
| 46 | 46 | } |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | $this->value = $value; |
| 89 | 89 | $this->type = strtolower(gettype($value)); |
| 90 | 90 | |
| 91 | - if(is_array($value) && is_callable($value)) { |
|
| 91 | + if (is_array($value) && is_callable($value)) { |
|
| 92 | 92 | $this->type = self::TYPE_CALLABLE; |
| 93 | 93 | } |
| 94 | 94 | |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | * @param bool $enable |
| 127 | 127 | * @return VariableInfo |
| 128 | 128 | */ |
| 129 | - public function enableType(bool $enable=true) : VariableInfo |
|
| 129 | + public function enableType(bool $enable = true) : VariableInfo |
|
| 130 | 130 | { |
| 131 | 131 | return $this->setOption('prepend-type', $enable); |
| 132 | 132 | } |
@@ -135,9 +135,9 @@ discard block |
||
| 135 | 135 | { |
| 136 | 136 | $converted = $this->string; |
| 137 | 137 | |
| 138 | - if($this->getOption('prepend-type') === true && !$this->isNull()) |
|
| 138 | + if ($this->getOption('prepend-type') === true && !$this->isNull()) |
|
| 139 | 139 | { |
| 140 | - if($this->isString()) |
|
| 140 | + if ($this->isString()) |
|
| 141 | 141 | { |
| 142 | 142 | $converted = '"'.$converted.'"'; |
| 143 | 143 | } |