@@ -5,7 +5,6 @@ |
||
| 5 | 5 | use Ffcms\Core\App; |
| 6 | 6 | use Ffcms\Core\Helper\Type\Any; |
| 7 | 7 | use Ffcms\Core\Helper\Type\Arr; |
| 8 | -use Ffcms\Core\Helper\Type\Obj; |
|
| 9 | 8 | use Ffcms\Core\Helper\Type\Str; |
| 10 | 9 | use Symfony\Component\HttpFoundation\RedirectResponse as Redirect; |
| 11 | 10 | use Symfony\Component\HttpFoundation\Request as FoundationRequest; |
@@ -141,18 +141,21 @@ discard block |
||
| 141 | 141 | $routing = App::$Properties->getAll('Routing'); |
| 142 | 142 | |
| 143 | 143 | // try to work with static aliases |
| 144 | - if (Any::isArray($routing) && isset($routing['Alias'], $routing['Alias'][env_name])) |
|
| 145 | - $pathway = $this->findStaticAliases($routing['Alias'][env_name], $pathway); |
|
| 144 | + if (Any::isArray($routing) && isset($routing['Alias'], $routing['Alias'][env_name])) { |
|
| 145 | + $pathway = $this->findStaticAliases($routing['Alias'][env_name], $pathway); |
|
| 146 | + } |
|
| 146 | 147 | |
| 147 | 148 | $this->setPathdata(explode('/', trim($pathway, '/'))); |
| 148 | 149 | |
| 149 | 150 | // set default controller and action for undefined data |
| 150 | - if (!$this->action) |
|
| 151 | - $this->action = 'Index'; |
|
| 151 | + if (!$this->action) { |
|
| 152 | + $this->action = 'Index'; |
|
| 153 | + } |
|
| 152 | 154 | |
| 153 | 155 | // empty or contains backslashes? set to main |
| 154 | - if (!$this->controller || Str::contains('\\', $this->controller)) |
|
| 155 | - $this->controller = 'Main'; |
|
| 156 | + if (!$this->controller || Str::contains('\\', $this->controller)) { |
|
| 157 | + $this->controller = 'Main'; |
|
| 158 | + } |
|
| 156 | 159 | |
| 157 | 160 | // find callback injection in routing configs (calculated in App::run()) |
| 158 | 161 | if (Any::isArray($routing) && isset($routing['Callback'], $routing['Callback'][env_name])) { |
@@ -170,8 +173,9 @@ discard block |
||
| 170 | 173 | /** @var array $routing */ |
| 171 | 174 | $routing = App::$Properties->getAll('Routing'); |
| 172 | 175 | |
| 173 | - if (!Any::isArray($routing) || !isset($routing['Redirect']) || !Any::isArray($routing['Redirect'])) |
|
| 174 | - return; |
|
| 176 | + if (!Any::isArray($routing) || !isset($routing['Redirect']) || !Any::isArray($routing['Redirect'])) { |
|
| 177 | + return; |
|
| 178 | + } |
|
| 175 | 179 | |
| 176 | 180 | // check if source uri is key in redirect target map |
| 177 | 181 | if (array_key_exists($pathway, $routing['Redirect'])) { |
@@ -230,8 +234,9 @@ discard block |
||
| 230 | 234 | */ |
| 231 | 235 | private function findDynamicCallbacks(array $map = null, ?string $controller = null) |
| 232 | 236 | { |
| 233 | - if ($map === null) |
|
| 234 | - return; |
|
| 237 | + if ($map === null) { |
|
| 238 | + return; |
|
| 239 | + } |
|
| 235 | 240 | |
| 236 | 241 | // try to find global callback for this controller slug |
| 237 | 242 | if (array_key_exists($controller, $map)) { |
@@ -248,8 +253,9 @@ discard block |
||
| 248 | 253 | private function loadTrustedProxies() |
| 249 | 254 | { |
| 250 | 255 | $proxies = App::$Properties->get('trustedProxy'); |
| 251 | - if ($proxies === null || Str::likeEmpty($proxies)) |
|
| 252 | - return; |
|
| 256 | + if ($proxies === null || Str::likeEmpty($proxies)) { |
|
| 257 | + return; |
|
| 258 | + } |
|
| 253 | 259 | |
| 254 | 260 | $pList = explode(',', $proxies); |
| 255 | 261 | $resultList = []; |
@@ -265,8 +271,9 @@ discard block |
||
| 265 | 271 | */ |
| 266 | 272 | private function setPathdata(?array $pathArray = null) |
| 267 | 273 | { |
| 268 | - if (!Any::isArray($pathArray) || count($pathArray) < 1) |
|
| 269 | - return; |
|
| 274 | + if (!Any::isArray($pathArray) || count($pathArray) < 1) { |
|
| 275 | + return; |
|
| 276 | + } |
|
| 270 | 277 | |
| 271 | 278 | // check if array length is more then 4 basic elements and slice it recursive |
| 272 | 279 | if (count($pathArray) > 4) { |
@@ -295,8 +302,9 @@ discard block |
||
| 295 | 302 | public function getPathInfo() |
| 296 | 303 | { |
| 297 | 304 | $route = $this->languageInPath ? Str::sub(parent::getPathInfo(), Str::length($this->language) + 1) : parent::getPathInfo(); |
| 298 | - if (!Str::startsWith('/', $route)) |
|
| 299 | - $route = '/' . $route; |
|
| 305 | + if (!Str::startsWith('/', $route)) { |
|
| 306 | + $route = '/' . $route; |
|
| 307 | + } |
|
| 300 | 308 | return $route; |
| 301 | 309 | } |
| 302 | 310 | |
@@ -439,8 +447,9 @@ discard block |
||
| 439 | 447 | public function getPathWithoutControllerAction(): ?string |
| 440 | 448 | { |
| 441 | 449 | $path = trim($this->getPathInfo(), '/'); |
| 442 | - if ($this->aliasPathTarget !== null) |
|
| 443 | - $path = trim($this->aliasPathTarget, '/'); |
|
| 450 | + if ($this->aliasPathTarget !== null) { |
|
| 451 | + $path = trim($this->aliasPathTarget, '/'); |
|
| 452 | + } |
|
| 444 | 453 | |
| 445 | 454 | $pathArray = explode('/', $path); |
| 446 | 455 | if ($pathArray[0] === Str::lowerCase($this->getController())) { |
@@ -8,7 +8,6 @@ |
||
| 8 | 8 | use Ffcms\Core\Exception\SyntaxException; |
| 9 | 9 | use Ffcms\Core\Helper\ModelFilters; |
| 10 | 10 | use Ffcms\Core\Helper\Type\Any; |
| 11 | -use Ffcms\Core\Helper\Type\Obj; |
|
| 12 | 11 | use Ffcms\Core\Helper\Type\Str; |
| 13 | 12 | |
| 14 | 13 | /** |
@@ -59,21 +59,24 @@ discard block |
||
| 59 | 59 | public function runValidate(array $rules = null) |
| 60 | 60 | { |
| 61 | 61 | // skip validation on empty rules |
| 62 | - if ($rules === null) |
|
| 63 | - return true; |
|
| 62 | + if ($rules === null) { |
|
| 63 | + return true; |
|
| 64 | + } |
|
| 64 | 65 | |
| 65 | 66 | $success = true; |
| 66 | 67 | // list each rule as single one |
| 67 | 68 | foreach ($rules as $rule) { |
| 68 | 69 | // 0 = field (property) name, 1 = filter name, 2 = filter value |
| 69 | - if ($rule[0] === null || $rule[1] === null) |
|
| 70 | - continue; |
|
| 70 | + if ($rule[0] === null || $rule[1] === null) { |
|
| 71 | + continue; |
|
| 72 | + } |
|
| 71 | 73 | |
| 72 | 74 | $propertyName = $rule[0]; |
| 73 | 75 | $validationRule = $rule[1]; |
| 74 | 76 | $validationValue = null; |
| 75 | - if (isset($rule[2])) |
|
| 76 | - $validationValue = $rule[2]; |
|
| 77 | + if (isset($rule[2])) { |
|
| 78 | + $validationValue = $rule[2]; |
|
| 79 | + } |
|
| 77 | 80 | |
| 78 | 81 | // check if target field defined as array and make recursive validation |
| 79 | 82 | if (Any::isArray($propertyName)) { |
@@ -170,8 +173,9 @@ discard block |
||
| 170 | 173 | if ($propertyName !== $field_set_name) { // array-based property |
| 171 | 174 | $dot_path = trim(strstr($propertyName, '.'), '.'); |
| 172 | 175 | // prevent throws any exceptions for null and false objects |
| 173 | - if (!Any::isArray($this->{$field_set_name})) |
|
| 174 | - $this->{$field_set_name} = []; |
|
| 176 | + if (!Any::isArray($this->{$field_set_name})) { |
|
| 177 | + $this->{$field_set_name} = []; |
|
| 178 | + } |
|
| 175 | 179 | |
| 176 | 180 | // use dot-data provider to compile output array |
| 177 | 181 | $dotData = new DotData($this->{$field_set_name}); |
@@ -201,14 +205,16 @@ discard block |
||
| 201 | 205 | $sources = $this->sources(); |
| 202 | 206 | $types = $this->types(); |
| 203 | 207 | // validate sources for current field |
| 204 | - if (array_key_exists($propertyName, $sources)) |
|
| 205 | - $inputType = Str::lowerCase($sources[$propertyName]); |
|
| 208 | + if (array_key_exists($propertyName, $sources)) { |
|
| 209 | + $inputType = Str::lowerCase($sources[$propertyName]); |
|
| 210 | + } |
|
| 206 | 211 | |
| 207 | 212 | |
| 208 | 213 | // check if field is array-nested element by dots and use first element as general |
| 209 | 214 | $filterField = $propertyName; |
| 210 | - if (array_key_exists($filterField, $types)) |
|
| 211 | - $filterType = Str::lowerCase($types[$filterField]); |
|
| 215 | + if (array_key_exists($filterField, $types)) { |
|
| 216 | + $filterType = Str::lowerCase($types[$filterField]); |
|
| 217 | + } |
|
| 212 | 218 | |
| 213 | 219 | // get clear field value |
| 214 | 220 | $propertyValue = $this->getRequest($propertyName, $inputType); |
@@ -310,8 +316,9 @@ discard block |
||
| 310 | 316 | */ |
| 311 | 317 | public function getRequest($param, $method = null) |
| 312 | 318 | { |
| 313 | - if ($method === null) |
|
| 314 | - $method = $this->_sendMethod; |
|
| 319 | + if ($method === null) { |
|
| 320 | + $method = $this->_sendMethod; |
|
| 321 | + } |
|
| 315 | 322 | |
| 316 | 323 | $method = Str::lowerCase($method); |
| 317 | 324 | // get root request as array or string |
@@ -335,8 +342,9 @@ discard block |
||
| 335 | 342 | if (Str::contains('.', $param)) { |
| 336 | 343 | $response = $request; |
| 337 | 344 | foreach (explode('.', $param) as $path) { |
| 338 | - if (!array_key_exists($path, $response)) |
|
| 339 | - return null; |
|
| 345 | + if (!array_key_exists($path, $response)) { |
|
| 346 | + return null; |
|
| 347 | + } |
|
| 340 | 348 | // find deep array nesting offset |
| 341 | 349 | $response = $response[$path]; |
| 342 | 350 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | if (!class_exists($class) || !method_exists($class, $method)) |
| 75 | 75 | return false; |
| 76 | 76 | |
| 77 | - $callback = (string)$class . '::' . (string)$method; |
|
| 77 | + $callback = (string)$class.'::'.(string)$method; |
|
| 78 | 78 | |
| 79 | 79 | // add instance to cron task manager |
| 80 | 80 | if (!isset($this->configs['instances'][$callback])) { |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | public function remove($class, $method) |
| 94 | 94 | { |
| 95 | - $callback = $class . '::' . $method; |
|
| 95 | + $callback = $class.'::'.$method; |
|
| 96 | 96 | if (isset($this->configs['instances'][$callback])) { |
| 97 | 97 | unset($this->configs['instances'][$callback], $this->configs['log'][$callback]); |
| 98 | 98 | App::$Properties->writeConfig('Cron', $this->configs); |
@@ -23,8 +23,9 @@ discard block |
||
| 23 | 23 | { |
| 24 | 24 | /** @var array $configs */ |
| 25 | 25 | $configs = App::$Properties->getAll('Cron'); |
| 26 | - if (Any::isArray($configs)) |
|
| 27 | - $this->configs = $configs; |
|
| 26 | + if (Any::isArray($configs)) { |
|
| 27 | + $this->configs = $configs; |
|
| 28 | + } |
|
| 28 | 29 | } |
| 29 | 30 | |
| 30 | 31 | /** |
@@ -34,8 +35,9 @@ discard block |
||
| 34 | 35 | public function run() |
| 35 | 36 | { |
| 36 | 37 | // check if cron instances is defined |
| 37 | - if (!isset($this->configs['instances']) || !Any::isArray($this->configs['instances'])) |
|
| 38 | - return null; |
|
| 38 | + if (!isset($this->configs['instances']) || !Any::isArray($this->configs['instances'])) { |
|
| 39 | + return null; |
|
| 40 | + } |
|
| 39 | 41 | |
| 40 | 42 | // get timestamp |
| 41 | 43 | $time = time(); |
@@ -71,8 +73,9 @@ discard block |
||
| 71 | 73 | public function register($class, $method, $delay = 60) |
| 72 | 74 | { |
| 73 | 75 | // check if declared callback is exist over autoload |
| 74 | - if (!class_exists($class) || !method_exists($class, $method)) |
|
| 75 | - return false; |
|
| 76 | + if (!class_exists($class) || !method_exists($class, $method)) { |
|
| 77 | + return false; |
|
| 78 | + } |
|
| 76 | 79 | |
| 77 | 80 | $callback = (string)$class . '::' . (string)$method; |
| 78 | 81 | |
@@ -41,9 +41,9 @@ discard block |
||
| 41 | 41 | return true; |
| 42 | 42 | |
| 43 | 43 | // try to load from file |
| 44 | - $configFile = ucfirst(Str::lowerCase($configName)) . '.php'; |
|
| 45 | - if (File::exist('/Private/Config/' . $configFile)) { |
|
| 46 | - $this->data[$configName] = File::inc('/Private/Config/' . $configFile, true); |
|
| 44 | + $configFile = ucfirst(Str::lowerCase($configName)).'.php'; |
|
| 45 | + if (File::exist('/Private/Config/'.$configFile)) { |
|
| 46 | + $this->data[$configName] = File::inc('/Private/Config/'.$configFile, true); |
|
| 47 | 47 | return true; |
| 48 | 48 | } |
| 49 | 49 | |
@@ -132,11 +132,11 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | public function writeConfig(string $configFile, array $data): bool |
| 134 | 134 | { |
| 135 | - $path = '/Private/Config/' . ucfirst(Str::lowerCase($configFile)) . '.php'; |
|
| 135 | + $path = '/Private/Config/'.ucfirst(Str::lowerCase($configFile)).'.php'; |
|
| 136 | 136 | if (!File::exist($path) || !File::writable($path)) |
| 137 | 137 | return false; |
| 138 | 138 | |
| 139 | - $saveData = '<?php return ' . Arr::exportVar($data) . ';'; |
|
| 139 | + $saveData = '<?php return '.Arr::exportVar($data).';'; |
|
| 140 | 140 | File::write($path, $saveData); |
| 141 | 141 | // overload config values if changed |
| 142 | 142 | $this->load($configFile, true); |
@@ -24,8 +24,9 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | public function __construct() |
| 26 | 26 | { |
| 27 | - if (!$this->load('default')) |
|
| 28 | - throw new NativeException('Default configurations is not founded: /Private/Config/Default.php'); |
|
| 27 | + if (!$this->load('default')) { |
|
| 28 | + throw new NativeException('Default configurations is not founded: /Private/Config/Default.php'); |
|
| 29 | + } |
|
| 29 | 30 | } |
| 30 | 31 | |
| 31 | 32 | /** |
@@ -37,8 +38,9 @@ discard block |
||
| 37 | 38 | private function load(string $configName, $overload = false): bool |
| 38 | 39 | { |
| 39 | 40 | // check if always loaded |
| 40 | - if (Any::isArray($this->data) && array_key_exists($configName, $this->data) && !$overload) |
|
| 41 | - return true; |
|
| 41 | + if (Any::isArray($this->data) && array_key_exists($configName, $this->data) && !$overload) { |
|
| 42 | + return true; |
|
| 43 | + } |
|
| 42 | 44 | |
| 43 | 45 | // try to load from file |
| 44 | 46 | $configFile = ucfirst(Str::lowerCase($configName)) . '.php'; |
@@ -61,12 +63,14 @@ discard block |
||
| 61 | 63 | { |
| 62 | 64 | $this->load($configFile); |
| 63 | 65 | // check if configs for this file is loaded |
| 64 | - if (!isset($this->data[$configFile])) |
|
| 65 | - return false; |
|
| 66 | + if (!isset($this->data[$configFile])) { |
|
| 67 | + return false; |
|
| 68 | + } |
|
| 66 | 69 | |
| 67 | 70 | // check if config key is exist |
| 68 | - if (!isset($this->data[$configFile][$configKey])) |
|
| 69 | - return false; |
|
| 71 | + if (!isset($this->data[$configFile][$configKey])) { |
|
| 72 | + return false; |
|
| 73 | + } |
|
| 70 | 74 | |
| 71 | 75 | $response = $this->data[$configFile][$configKey]; |
| 72 | 76 | |
@@ -100,8 +104,9 @@ discard block |
||
| 100 | 104 | public function getAll($configFile = 'default'): ?array |
| 101 | 105 | { |
| 102 | 106 | $this->load($configFile); |
| 103 | - if (!Any::isArray($this->data) || !array_key_exists($configFile, $this->data)) |
|
| 104 | - return null; |
|
| 107 | + if (!Any::isArray($this->data) || !array_key_exists($configFile, $this->data)) { |
|
| 108 | + return null; |
|
| 109 | + } |
|
| 105 | 110 | |
| 106 | 111 | return $this->data[$configFile]; |
| 107 | 112 | } |
@@ -116,8 +121,9 @@ discard block |
||
| 116 | 121 | public function updateConfig(string $configFile, array $newData, ?bool $mergeDeep = false): bool |
| 117 | 122 | { |
| 118 | 123 | $this->load($configFile); |
| 119 | - if (!isset($this->data[$configFile])) |
|
| 120 | - return false; |
|
| 124 | + if (!isset($this->data[$configFile])) { |
|
| 125 | + return false; |
|
| 126 | + } |
|
| 121 | 127 | |
| 122 | 128 | $oldData = $this->data[$configFile]; |
| 123 | 129 | $saveData = ($mergeDeep ? Arr::mergeRecursive($oldData, $newData) : Arr::merge($oldData, $newData)); |
@@ -133,8 +139,9 @@ discard block |
||
| 133 | 139 | public function writeConfig(string $configFile, array $data): bool |
| 134 | 140 | { |
| 135 | 141 | $path = '/Private/Config/' . ucfirst(Str::lowerCase($configFile)) . '.php'; |
| 136 | - if (!File::exist($path) || !File::writable($path)) |
|
| 137 | - return false; |
|
| 142 | + if (!File::exist($path) || !File::writable($path)) { |
|
| 143 | + return false; |
|
| 144 | + } |
|
| 138 | 145 | |
| 139 | 146 | $saveData = '<?php return ' . Arr::exportVar($data) . ';'; |
| 140 | 147 | File::write($path, $saveData); |
@@ -41,11 +41,13 @@ discard block |
||
| 41 | 41 | public function getLocaled(string $attribute) |
| 42 | 42 | { |
| 43 | 43 | // if always decoded |
| 44 | - if (Any::isArray($this->{$attribute})) |
|
| 45 | - return $this->{$attribute}[App::$Request->getLanguage()]; |
|
| 44 | + if (Any::isArray($this->{$attribute})) { |
|
| 45 | + return $this->{$attribute}[App::$Request->getLanguage()]; |
|
| 46 | + } |
|
| 46 | 47 | |
| 47 | - if (!Any::isStr($attribute) || Str::likeEmpty($this->{$attribute})) |
|
| 48 | - return null; |
|
| 48 | + if (!Any::isStr($attribute) || Str::likeEmpty($this->{$attribute})) { |
|
| 49 | + return null; |
|
| 50 | + } |
|
| 49 | 51 | |
| 50 | 52 | return Serialize::getDecodeLocale($this->{$attribute}); |
| 51 | 53 | } |
@@ -58,8 +60,9 @@ discard block |
||
| 58 | 60 | */ |
| 59 | 61 | public function setAttribute($key, $value) |
| 60 | 62 | { |
| 61 | - if ($value !== null && $this->isSerializeCastable($key)) |
|
| 62 | - $value = $this->asSerialize($value); |
|
| 63 | + if ($value !== null && $this->isSerializeCastable($key)) { |
|
| 64 | + $value = $this->asSerialize($value); |
|
| 65 | + } |
|
| 63 | 66 | |
| 64 | 67 | return parent::setAttribute($key, $value); |
| 65 | 68 | } |
@@ -72,11 +75,13 @@ discard block |
||
| 72 | 75 | */ |
| 73 | 76 | protected function castAttribute($key, $value) |
| 74 | 77 | { |
| 75 | - if ($value === null) |
|
| 76 | - return $value; |
|
| 78 | + if ($value === null) { |
|
| 79 | + return $value; |
|
| 80 | + } |
|
| 77 | 81 | |
| 78 | - if ($this->getCastType($key) === 'serialize') |
|
| 79 | - return $this->fromSerialize($value); |
|
| 82 | + if ($this->getCastType($key) === 'serialize') { |
|
| 83 | + return $this->fromSerialize($value); |
|
| 84 | + } |
|
| 80 | 85 | |
| 81 | 86 | return parent::castAttribute($key, $value); |
| 82 | 87 | } |
@@ -28,8 +28,9 @@ discard block |
||
| 28 | 28 | public static function convertToDatetime($rawDate, $format = 'd.m.Y') |
| 29 | 29 | { |
| 30 | 30 | // convert timestamp to date format |
| 31 | - if (Any::isInt($rawDate)) |
|
| 32 | - $rawDate = date(\DateTime::ATOM, $rawDate); |
|
| 31 | + if (Any::isInt($rawDate)) { |
|
| 32 | + $rawDate = date(\DateTime::ATOM, $rawDate); |
|
| 33 | + } |
|
| 33 | 34 | |
| 34 | 35 | try { |
| 35 | 36 | $object = new \DateTime($rawDate); |
@@ -61,15 +62,17 @@ discard block |
||
| 61 | 62 | // convert to timestamp |
| 62 | 63 | $timestamp = $raw; |
| 63 | 64 | // raw can be instance of eloquent active record object, convert to str |
| 64 | - if (!Any::isInt($raw)) |
|
| 65 | - $timestamp = self::convertToTimestamp((string)$timestamp); |
|
| 65 | + if (!Any::isInt($raw)) { |
|
| 66 | + $timestamp = self::convertToTimestamp((string)$timestamp); |
|
| 67 | + } |
|
| 66 | 68 | |
| 67 | 69 | // calculate difference between tomorrow day midnight and passed date |
| 68 | 70 | $diff = time() - $timestamp; |
| 69 | 71 | |
| 70 | 72 | // date in future, lets return as is |
| 71 | - if ($diff < 0) |
|
| 72 | - return self::convertToDatetime($timestamp, static::FORMAT_TO_SECONDS); |
|
| 73 | + if ($diff < 0) { |
|
| 74 | + return self::convertToDatetime($timestamp, static::FORMAT_TO_SECONDS); |
|
| 75 | + } |
|
| 73 | 76 | |
| 74 | 77 | // calculate delta and make offset sub. Maybe usage instance of Datetime is better, but localization is sucks! |
| 75 | 78 | $deltaSec = $diff % 60; |
@@ -86,8 +89,9 @@ discard block |
||
| 86 | 89 | // sounds like more then 1 day's ago |
| 87 | 90 | if ($deltaDays > 1) { |
| 88 | 91 | // sounds like more then 2 week ago, just return as is |
| 89 | - if ($deltaDays > 14) |
|
| 90 | - return self::convertToDatetime($timestamp, static::FORMAT_TO_HOUR); |
|
| 92 | + if ($deltaDays > 14) { |
|
| 93 | + return self::convertToDatetime($timestamp, static::FORMAT_TO_HOUR); |
|
| 94 | + } |
|
| 91 | 95 | |
| 92 | 96 | return App::$Translate->get('DateHuman', '%days% days ago', ['days' => (int)$deltaDays]); |
| 93 | 97 | } |
@@ -42,8 +42,9 @@ |
||
| 42 | 42 | */ |
| 43 | 43 | public static function getDecoded($data, $key) |
| 44 | 44 | { |
| 45 | - if (!Any::isArray($data)) |
|
| 46 | - $data = self::decode($data); |
|
| 45 | + if (!Any::isArray($data)) { |
|
| 46 | + $data = self::decode($data); |
|
| 47 | + } |
|
| 47 | 48 | |
| 48 | 49 | return $data === false ? null : $data[$key]; |
| 49 | 50 | } |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | // get options from properties |
| 42 | 42 | $options = $this->properties['options']; |
| 43 | 43 | if (!Any::isIterable($options)) |
| 44 | - throw new SyntaxException('Radio field ' . self::nohtml($this->name) . ' have no iterable options'); |
|
| 44 | + throw new SyntaxException('Radio field '.self::nohtml($this->name).' have no iterable options'); |
|
| 45 | 45 | |
| 46 | 46 | unset($this->properties['options'], $this->properties['value']); |
| 47 | 47 | |
@@ -40,8 +40,9 @@ |
||
| 40 | 40 | { |
| 41 | 41 | // get options from properties |
| 42 | 42 | $options = $this->properties['options']; |
| 43 | - if (!Any::isIterable($options)) |
|
| 44 | - throw new SyntaxException('Radio field ' . self::nohtml($this->name) . ' have no iterable options'); |
|
| 43 | + if (!Any::isIterable($options)) { |
|
| 44 | + throw new SyntaxException('Radio field ' . self::nohtml($this->name) . ' have no iterable options'); |
|
| 45 | + } |
|
| 45 | 46 | |
| 46 | 47 | unset($this->properties['options'], $this->properties['value']); |
| 47 | 48 | |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | $options = $this->properties['options']; |
| 37 | 37 | unset($this->properties['options']); |
| 38 | 38 | if (!Any::isIterable($options)) |
| 39 | - throw new SyntaxException('Select field ' . self::nohtml($this->name) . ' have no iterable options'); |
|
| 39 | + throw new SyntaxException('Select field '.self::nohtml($this->name).' have no iterable options'); |
|
| 40 | 40 | // value is not used there |
| 41 | 41 | unset($this->properties['value']); |
| 42 | 42 | // options is defined as key->value array? |
@@ -35,8 +35,9 @@ |
||
| 35 | 35 | // get options from properties |
| 36 | 36 | $options = $this->properties['options']; |
| 37 | 37 | unset($this->properties['options']); |
| 38 | - if (!Any::isIterable($options)) |
|
| 39 | - throw new SyntaxException('Select field ' . self::nohtml($this->name) . ' have no iterable options'); |
|
| 38 | + if (!Any::isIterable($options)) { |
|
| 39 | + throw new SyntaxException('Select field ' . self::nohtml($this->name) . ' have no iterable options'); |
|
| 40 | + } |
|
| 40 | 41 | // value is not used there |
| 41 | 42 | unset($this->properties['value']); |
| 42 | 43 | // options is defined as key->value array? |