@@ -16,8 +16,9 @@ discard block |
||
16 | 16 | */ |
17 | 17 | public function startMeasure(string $name): void |
18 | 18 | { |
19 | - if (App::$Debug) |
|
20 | - App::$Debug->startMeasure($name); |
|
19 | + if (App::$Debug) { |
|
20 | + App::$Debug->startMeasure($name); |
|
21 | + } |
|
21 | 22 | } |
22 | 23 | |
23 | 24 | /** |
@@ -26,7 +27,8 @@ discard block |
||
26 | 27 | */ |
27 | 28 | public function stopMeasure(string $name): void |
28 | 29 | { |
29 | - if (App::$Debug) |
|
30 | - App::$Debug->stopMeasure($name); |
|
30 | + if (App::$Debug) { |
|
31 | + App::$Debug->stopMeasure($name); |
|
32 | + } |
|
31 | 33 | } |
32 | 34 | } |
33 | 35 | \ No newline at end of file |
@@ -93,9 +93,9 @@ discard block |
||
93 | 93 | { |
94 | 94 | // looks like a single tag, <img src="" class="" />, <hr class="" /> |
95 | 95 | if (Arr::in($name, self::$singleTags)) { |
96 | - return '<' . $name . self::applyProperties($properties) . ' />'; |
|
97 | - } elseif(Arr::in($name, self::$containerTags)) { // looks like a container tag, <div class=""></div> |
|
98 | - return '<' . $name . self::applyProperties($properties) . '>' . $content . '</' . $name . '>'; |
|
96 | + return '<'.$name.self::applyProperties($properties).' />'; |
|
97 | + } elseif (Arr::in($name, self::$containerTags)) { // looks like a container tag, <div class=""></div> |
|
98 | + return '<'.$name.self::applyProperties($properties).'>'.$content.'</'.$name.'>'; |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | // empty response |
@@ -122,9 +122,9 @@ discard block |
||
122 | 122 | } |
123 | 123 | // sounds like single standalone property, ex required, selected etc |
124 | 124 | if ($value === null || $value === false) { |
125 | - $build .= ' ' . htmlentities($property, ENT_QUOTES, "UTF-8"); |
|
125 | + $build .= ' '.htmlentities($property, ENT_QUOTES, "UTF-8"); |
|
126 | 126 | } else { // sounds like a classic key="value" property |
127 | - $build .= ' ' . htmlentities($property, ENT_QUOTES, "UTF-8") . '="' . htmlentities($value, ENT_QUOTES, "UTF-8") . '"'; |
|
127 | + $build .= ' '.htmlentities($property, ENT_QUOTES, "UTF-8").'="'.htmlentities($value, ENT_QUOTES, "UTF-8").'"'; |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | return $build; |
@@ -60,11 +60,11 @@ discard block |
||
60 | 60 | |
61 | 61 | $basePath = trim(App::$Properties->get('basePath'), '/'); |
62 | 62 | if ($basePath !== null && Str::length($basePath) > 0) { |
63 | - $basePath = '/' . $basePath; |
|
63 | + $basePath = '/'.$basePath; |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | if (!defined('env_no_uri') || env_no_uri === false) { |
67 | - $basePath .= '/' . strtolower(env_name); |
|
67 | + $basePath .= '/'.strtolower(env_name); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | // we never try to use path's without friendly url's |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | } else { |
91 | 91 | // try to find language in pathway |
92 | 92 | foreach (App::$Properties->get('languages') as $lang) { |
93 | - if (Str::startsWith('/' . $lang, $this->getPathInfo())) { |
|
93 | + if (Str::startsWith('/'.$lang, $this->getPathInfo())) { |
|
94 | 94 | $this->language = $lang; |
95 | 95 | $this->languageInPath = true; |
96 | 96 | } |
@@ -117,11 +117,11 @@ discard block |
||
117 | 117 | // parse query string |
118 | 118 | $queryString = null; |
119 | 119 | if (count($this->query->all()) > 0) { |
120 | - $queryString = '?' . http_build_query($this->query->all()); |
|
120 | + $queryString = '?'.http_build_query($this->query->all()); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | // build response with redirect to language-based path |
124 | - $response = new Redirect($this->getSchemeAndHttpHost() . $this->basePath . '/' . $userLang . $this->getPathInfo() . $queryString); |
|
124 | + $response = new Redirect($this->getSchemeAndHttpHost().$this->basePath.'/'.$userLang.$this->getPathInfo().$queryString); |
|
125 | 125 | $response->send(); |
126 | 126 | exit(); |
127 | 127 | } |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | if (array_key_exists($pathway, $routing['Redirect'])) { |
181 | 181 | $target = $this->getSchemeAndHttpHost(); // . $this->getBasePath() . '/' . rtrim($routing['Redirect'][$pathway], '/'); |
182 | 182 | if ($this->getBasePath() !== null && !Str::likeEmpty($this->getBasePath())) { |
183 | - $target .= '/' . $this->getBasePath(); |
|
183 | + $target .= '/'.$this->getBasePath(); |
|
184 | 184 | } |
185 | 185 | $target .= rtrim($routing['Redirect'][$pathway], '/'); |
186 | 186 | $redirect = new Redirect($target); |
@@ -206,9 +206,9 @@ discard block |
||
206 | 206 | // find "new path" as binding uri slug |
207 | 207 | $binding = array_search($pathway, $map, true); |
208 | 208 | // build url to redirection |
209 | - $url = $this->getSchemeAndHttpHost() . $this->getBasePath() . '/'; |
|
209 | + $url = $this->getSchemeAndHttpHost().$this->getBasePath().'/'; |
|
210 | 210 | if (App::$Properties->get('multiLanguage')) { |
211 | - $url .= $this->language . '/'; |
|
211 | + $url .= $this->language.'/'; |
|
212 | 212 | } |
213 | 213 | $url .= ltrim($binding, '/'); |
214 | 214 | |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | { |
303 | 303 | $route = $this->languageInPath ? Str::sub(parent::getPathInfo(), Str::length($this->language) + 1) : parent::getPathInfo(); |
304 | 304 | if (!Str::startsWith('/', $route)) |
305 | - $route = '/' . $route; |
|
305 | + $route = '/'.$route; |
|
306 | 306 | return $route; |
307 | 307 | } |
308 | 308 | |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | */ |
467 | 467 | public function getFullUrl(): string |
468 | 468 | { |
469 | - return $this->getSchemeAndHttpHost() . $this->getRequestUri(); |
|
469 | + return $this->getSchemeAndHttpHost().$this->getRequestUri(); |
|
470 | 470 | } |
471 | 471 | |
472 | 472 | /** |
@@ -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())) { |
@@ -6,15 +6,11 @@ |
||
6 | 6 | use Ffcms\Core\Cache\MemoryObject; |
7 | 7 | use Ffcms\Core\Debug\DebugMeasure; |
8 | 8 | use Ffcms\Core\Debug\Manager as Debug; |
9 | -use Ffcms\Core\Exception\ForbiddenException; |
|
10 | -use Ffcms\Core\Exception\JsonException; |
|
11 | 9 | use Ffcms\Core\Exception\NativeException; |
12 | 10 | use Ffcms\Core\Exception\NotFoundException; |
13 | -use Ffcms\Core\Exception\SyntaxException; |
|
14 | 11 | use Ffcms\Core\Exception\TemplateException; |
15 | 12 | use Ffcms\Core\Helper\Security; |
16 | 13 | use Ffcms\Core\Helper\Type\Any; |
17 | -use Ffcms\Core\Helper\Type\Obj; |
|
18 | 14 | use Ffcms\Core\Helper\Type\Str; |
19 | 15 | use Ffcms\Core\I18n\Translate; |
20 | 16 | use Ffcms\Core\Managers\BootManager; |
@@ -185,22 +185,22 @@ discard block |
||
185 | 185 | $html = null; |
186 | 186 | // lets try to get html full content to page render |
187 | 187 | try { |
188 | - $this->startMeasure(__METHOD__ . '::callback'); |
|
188 | + $this->startMeasure(__METHOD__.'::callback'); |
|
189 | 189 | /** @var \Ffcms\Core\Arch\Controller $callClass */ |
190 | 190 | $callClass = null; |
191 | - $callMethod = 'action' . self::$Request->getAction(); |
|
191 | + $callMethod = 'action'.self::$Request->getAction(); |
|
192 | 192 | |
193 | 193 | // define callback class namespace/name full path |
194 | - $cName = (self::$Request->getCallbackAlias() ?? '\Apps\Controller\\' . env_name . '\\' . self::$Request->getController()); |
|
194 | + $cName = (self::$Request->getCallbackAlias() ?? '\Apps\Controller\\'.env_name.'\\'.self::$Request->getController()); |
|
195 | 195 | if (!class_exists($cName)) |
196 | - throw new NotFoundException('Callback class not found: ' . App::$Security->strip_tags($cName)); |
|
196 | + throw new NotFoundException('Callback class not found: '.App::$Security->strip_tags($cName)); |
|
197 | 197 | |
198 | 198 | $callClass = new $cName; |
199 | 199 | // check if callback method (action) is exist in class object |
200 | 200 | if (!method_exists($callClass, $callMethod)) |
201 | - throw new NotFoundException('Method "' . App::$Security->strip_tags($callMethod) . '()" not founded in "' . get_class($callClass) . '"'); |
|
201 | + throw new NotFoundException('Method "'.App::$Security->strip_tags($callMethod).'()" not founded in "'.get_class($callClass).'"'); |
|
202 | 202 | |
203 | - $this->stopMeasure(__METHOD__ . '::callback'); |
|
203 | + $this->stopMeasure(__METHOD__.'::callback'); |
|
204 | 204 | $params = []; |
205 | 205 | if (!Str::likeEmpty(self::$Request->getID())) { |
206 | 206 | $params[] = self::$Request->getID(); |
@@ -224,10 +224,10 @@ discard block |
||
224 | 224 | 'current' => count($params) |
225 | 225 | ])); |
226 | 226 | |
227 | - $this->startMeasure($cName . '::' . $callMethod); |
|
227 | + $this->startMeasure($cName.'::'.$callMethod); |
|
228 | 228 | // make callback call to action in controller and get response |
229 | 229 | $actionResponse = call_user_func_array([$callClass, $callMethod], $params); |
230 | - $this->stopMeasure($cName . '::' . $callMethod); |
|
230 | + $this->stopMeasure($cName.'::'.$callMethod); |
|
231 | 231 | |
232 | 232 | // set response to controller attribute |
233 | 233 | if (!Str::likeEmpty($actionResponse)) |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | $html = $e->display(); |
242 | 242 | } else { // or hook exception to system based :))) |
243 | 243 | if (App::$Debug) { |
244 | - $msg = $e->getMessage() . $e->getTraceAsString(); |
|
244 | + $msg = $e->getMessage().$e->getTraceAsString(); |
|
245 | 245 | $html = (new NativeException($msg))->display(); |
246 | 246 | } else { |
247 | 247 | $html = (new NativeException($e->getMessage()))->display(); |
@@ -156,8 +156,9 @@ discard block |
||
156 | 156 | |
157 | 157 | /** @var array $objects */ |
158 | 158 | $objects = App::$Properties->getAll('object'); |
159 | - if (!Any::isArray($objects)) |
|
160 | - throw new NativeException('Object configurations is not loaded: /Private/Config/Object.php'); |
|
159 | + if (!Any::isArray($objects)) { |
|
160 | + throw new NativeException('Object configurations is not loaded: /Private/Config/Object.php'); |
|
161 | + } |
|
161 | 162 | |
162 | 163 | // each all objects as service_name => service_instance() |
163 | 164 | foreach ($objects as $name => $instance) { |
@@ -192,20 +193,23 @@ discard block |
||
192 | 193 | |
193 | 194 | // define callback class namespace/name full path |
194 | 195 | $cName = (self::$Request->getCallbackAlias() ?? '\Apps\Controller\\' . env_name . '\\' . self::$Request->getController()); |
195 | - if (!class_exists($cName)) |
|
196 | - throw new NotFoundException('Callback class not found: ' . App::$Security->strip_tags($cName)); |
|
196 | + if (!class_exists($cName)) { |
|
197 | + throw new NotFoundException('Callback class not found: ' . App::$Security->strip_tags($cName)); |
|
198 | + } |
|
197 | 199 | |
198 | 200 | $callClass = new $cName; |
199 | 201 | // check if callback method (action) is exist in class object |
200 | - if (!method_exists($callClass, $callMethod)) |
|
201 | - throw new NotFoundException('Method "' . App::$Security->strip_tags($callMethod) . '()" not founded in "' . get_class($callClass) . '"'); |
|
202 | + if (!method_exists($callClass, $callMethod)) { |
|
203 | + throw new NotFoundException('Method "' . App::$Security->strip_tags($callMethod) . '()" not founded in "' . get_class($callClass) . '"'); |
|
204 | + } |
|
202 | 205 | |
203 | 206 | $this->stopMeasure(__METHOD__ . '::callback'); |
204 | 207 | $params = []; |
205 | 208 | if (!Str::likeEmpty(self::$Request->getID())) { |
206 | 209 | $params[] = self::$Request->getID(); |
207 | - if (!Str::likeEmpty(self::$Request->getAdd())) |
|
208 | - $params[] = self::$Request->getAdd(); |
|
210 | + if (!Str::likeEmpty(self::$Request->getAdd())) { |
|
211 | + $params[] = self::$Request->getAdd(); |
|
212 | + } |
|
209 | 213 | } |
210 | 214 | |
211 | 215 | // get instance of callback object (class::method) as reflection |
@@ -213,16 +217,18 @@ discard block |
||
213 | 217 | $argCount = 0; |
214 | 218 | // calculate method defined arguments count |
215 | 219 | foreach ($instance->getParameters() as $arg) { |
216 | - if (!$arg->isOptional()) |
|
217 | - $argCount++; |
|
220 | + if (!$arg->isOptional()) { |
|
221 | + $argCount++; |
|
222 | + } |
|
218 | 223 | } |
219 | 224 | // compare method arg count with passed |
220 | - if (count($params) < $argCount) |
|
221 | - throw new NotFoundException(__('Arguments for method %method% is not enough. Expected: %required%, got: %current%.', [ |
|
225 | + if (count($params) < $argCount) { |
|
226 | + throw new NotFoundException(__('Arguments for method %method% is not enough. Expected: %required%, got: %current%.', [ |
|
222 | 227 | 'method' => $callMethod, |
223 | 228 | 'required' => $argCount, |
224 | 229 | 'current' => count($params) |
225 | 230 | ])); |
231 | + } |
|
226 | 232 | |
227 | 233 | $this->startMeasure($cName . '::' . $callMethod); |
228 | 234 | // make callback call to action in controller and get response |
@@ -230,8 +236,9 @@ discard block |
||
230 | 236 | $this->stopMeasure($cName . '::' . $callMethod); |
231 | 237 | |
232 | 238 | // set response to controller attribute |
233 | - if (!Str::likeEmpty($actionResponse)) |
|
234 | - $callClass->setOutput($actionResponse); |
|
239 | + if (!Str::likeEmpty($actionResponse)) { |
|
240 | + $callClass->setOutput($actionResponse); |
|
241 | + } |
|
235 | 242 | |
236 | 243 | // build full compiled output html data with default layout and widgets |
237 | 244 | $html = $callClass->buildOutput(); |
@@ -249,7 +249,7 @@ |
||
249 | 249 | /** |
250 | 250 | * Show custom code library link |
251 | 251 | * @param string $type - js or css allowed |
252 | - * @return array|null|string |
|
252 | + * @return null|string |
|
253 | 253 | */ |
254 | 254 | public function showCodeLink(string $type) |
255 | 255 | { |
@@ -9,7 +9,6 @@ |
||
9 | 9 | use Ffcms\Core\Helper\FileSystem\File; |
10 | 10 | use Ffcms\Core\Helper\FileSystem\Normalize; |
11 | 11 | use Ffcms\Core\Helper\Type\Any; |
12 | -use Ffcms\Core\Helper\Type\Obj; |
|
13 | 12 | use Ffcms\Core\Helper\Type\Str; |
14 | 13 | use Ffcms\Core\Template\Variables; |
15 | 14 | use Ffcms\Core\Traits\DynamicGlobal; |
@@ -55,16 +55,16 @@ discard block |
||
55 | 55 | $this->lang = App::$Request->getLanguage(); |
56 | 56 | // get theme config and build full path |
57 | 57 | $themeConfig = App::$Properties->get('theme'); |
58 | - $this->themePath = root . DIRECTORY_SEPARATOR . 'Apps' . DIRECTORY_SEPARATOR . 'View' . DIRECTORY_SEPARATOR . env_name; |
|
58 | + $this->themePath = root.DIRECTORY_SEPARATOR.'Apps'.DIRECTORY_SEPARATOR.'View'.DIRECTORY_SEPARATOR.env_name; |
|
59 | 59 | if (isset($themeConfig[env_name]) && Str::length($themeConfig[env_name]) > 0) { |
60 | - $this->themePath .= DIRECTORY_SEPARATOR . $themeConfig[env_name]; |
|
60 | + $this->themePath .= DIRECTORY_SEPARATOR.$themeConfig[env_name]; |
|
61 | 61 | } else { |
62 | - $this->themePath .= DIRECTORY_SEPARATOR . 'default'; |
|
62 | + $this->themePath .= DIRECTORY_SEPARATOR.'default'; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | // check if theme is available |
66 | 66 | if (!Directory::exist($this->themePath)) |
67 | - throw new NativeException('Apps theme is not founded: ' . Str::replace(root, null, $this->themePath)); |
|
67 | + throw new NativeException('Apps theme is not founded: '.Str::replace(root, null, $this->themePath)); |
|
68 | 68 | |
69 | 69 | // get input args and build class properties |
70 | 70 | $args = func_get_args(); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | |
103 | 103 | // path still not defined? |
104 | 104 | if (!$path) |
105 | - throw new SyntaxException('View not found: ' . App::$Security->strip_tags($path)); |
|
105 | + throw new SyntaxException('View not found: '.App::$Security->strip_tags($path)); |
|
106 | 106 | |
107 | 107 | // cleanup from slashes on start/end |
108 | 108 | $path = trim($path, '/\\'); |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | // lets try to get full path for current theme |
131 | 131 | $tmpPath = $path; |
132 | 132 | if (!Str::startsWith($this->themePath, $path)) |
133 | - $tmpPath = Normalize::diskPath($this->themePath . '/' . $path . '.php'); |
|
133 | + $tmpPath = Normalize::diskPath($this->themePath.'/'.$path.'.php'); |
|
134 | 134 | } else { // sounds like a object-depended view call from controller or etc |
135 | 135 | // get stack trace of callbacks |
136 | 136 | $calledLog = @debug_backtrace(); |
@@ -144,13 +144,13 @@ discard block |
||
144 | 144 | |
145 | 145 | // depended controller is not founded? Let finish |
146 | 146 | if (!$calledController) |
147 | - throw new SyntaxException('View render is failed: callback controller not founded! Call with relative path: ' . $path); |
|
147 | + throw new SyntaxException('View render is failed: callback controller not founded! Call with relative path: '.$path); |
|
148 | 148 | |
149 | 149 | // get controller name |
150 | - $controllerName = Str::sub($calledController, Str::length('Apps\Controller\\' . env_name . '\\')); |
|
150 | + $controllerName = Str::sub($calledController, Str::length('Apps\Controller\\'.env_name.'\\')); |
|
151 | 151 | $controllerName = Str::lowerCase($controllerName); |
152 | 152 | // get full path |
153 | - $tmpPath = $this->themePath . DIRECTORY_SEPARATOR . $controllerName . DIRECTORY_SEPARATOR . $path . '.php'; |
|
153 | + $tmpPath = $this->themePath.DIRECTORY_SEPARATOR.$controllerName.DIRECTORY_SEPARATOR.$path.'.php'; |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | // check if builded view full path is exist |
@@ -159,18 +159,18 @@ discard block |
||
159 | 159 | |
160 | 160 | // hmm, not founded. Lets try to find in caller directory (for widgets, apps packages and other) |
161 | 161 | if ($source !== null) { |
162 | - $tmpPath = Normalize::diskPath($source . DIRECTORY_SEPARATOR . $path . '.php'); |
|
162 | + $tmpPath = Normalize::diskPath($source.DIRECTORY_SEPARATOR.$path.'.php'); |
|
163 | 163 | if (File::exist($tmpPath)) { |
164 | 164 | // add notify for native views |
165 | 165 | if (App::$Debug) |
166 | - App::$Debug->addMessage('Render native viewer: ' . Str::replace(root, null, $tmpPath), 'info'); |
|
166 | + App::$Debug->addMessage('Render native viewer: '.Str::replace(root, null, $tmpPath), 'info'); |
|
167 | 167 | |
168 | 168 | return $tmpPath; |
169 | 169 | } |
170 | 170 | } |
171 | 171 | |
172 | 172 | if (App::$Debug) |
173 | - App::$Debug->addMessage('Viewer not founded on rendering: ' . $path, 'warning'); |
|
173 | + App::$Debug->addMessage('Viewer not founded on rendering: '.$path, 'warning'); |
|
174 | 174 | |
175 | 175 | return null; |
176 | 176 | } |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | foreach ($items as $item) { |
263 | 263 | $item = trim($item, '/'); |
264 | 264 | if (!Str::startsWith(App::$Alias->scriptUrl, $item) && !Str::startsWith('http', $item)) { // is local without proto and domain |
265 | - $item = App::$Alias->scriptUrl . '/' . $item; |
|
265 | + $item = App::$Alias->scriptUrl.'/'.$item; |
|
266 | 266 | } |
267 | 267 | $output[] = $item; |
268 | 268 | } |
@@ -271,9 +271,9 @@ discard block |
||
271 | 271 | $output = null; |
272 | 272 | foreach ($clear as $row) { |
273 | 273 | if ($type === 'css') { |
274 | - $output .= '<link rel="stylesheet" type="text/css" href="' . $row . '">' . "\n"; |
|
274 | + $output .= '<link rel="stylesheet" type="text/css" href="'.$row.'">'."\n"; |
|
275 | 275 | } elseif ($type === 'js') { |
276 | - $output .= '<script src="' . $row . '"></script>' . "\n"; |
|
276 | + $output .= '<script src="'.$row.'"></script>'."\n"; |
|
277 | 277 | } |
278 | 278 | } |
279 | 279 | |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | |
296 | 296 | $code = null; |
297 | 297 | foreach (App::$Alias->getPlainCode($type) as $row) { |
298 | - $code .= $row . "\n"; |
|
298 | + $code .= $row."\n"; |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | return $code; |
@@ -63,8 +63,9 @@ discard block |
||
63 | 63 | } |
64 | 64 | |
65 | 65 | // check if theme is available |
66 | - if (!Directory::exist($this->themePath)) |
|
67 | - throw new NativeException('Apps theme is not founded: ' . Str::replace(root, null, $this->themePath)); |
|
66 | + if (!Directory::exist($this->themePath)) { |
|
67 | + throw new NativeException('Apps theme is not founded: ' . Str::replace(root, null, $this->themePath)); |
|
68 | + } |
|
68 | 69 | |
69 | 70 | // get input args and build class properties |
70 | 71 | $args = func_get_args(); |
@@ -89,20 +90,24 @@ discard block |
||
89 | 90 | $source = $this->sourcePath; |
90 | 91 | |
91 | 92 | // if path is not defined - try to find it in arguments |
92 | - if (!$path) |
|
93 | - $path = array_shift($arguments); |
|
93 | + if (!$path) { |
|
94 | + $path = array_shift($arguments); |
|
95 | + } |
|
94 | 96 | |
95 | 97 | // if arguments is not define - try to find in arguments |
96 | - if (!$params) |
|
97 | - $params = array_shift($arguments); |
|
98 | + if (!$params) { |
|
99 | + $params = array_shift($arguments); |
|
100 | + } |
|
98 | 101 | |
99 | 102 | // if directory of caller is not defiend - lets find in argument |
100 | - if (!$source) |
|
101 | - $source = array_shift($arguments); |
|
103 | + if (!$source) { |
|
104 | + $source = array_shift($arguments); |
|
105 | + } |
|
102 | 106 | |
103 | 107 | // path still not defined? |
104 | - if (!$path) |
|
105 | - throw new SyntaxException('View not found: ' . App::$Security->strip_tags($path)); |
|
108 | + if (!$path) { |
|
109 | + throw new SyntaxException('View not found: ' . App::$Security->strip_tags($path)); |
|
110 | + } |
|
106 | 111 | |
107 | 112 | // cleanup from slashes on start/end |
108 | 113 | $path = trim($path, '/\\'); |
@@ -129,8 +134,9 @@ discard block |
||
129 | 134 | if (Str::contains('/', $path)) { |
130 | 135 | // lets try to get full path for current theme |
131 | 136 | $tmpPath = $path; |
132 | - if (!Str::startsWith($this->themePath, $path)) |
|
133 | - $tmpPath = Normalize::diskPath($this->themePath . '/' . $path . '.php'); |
|
137 | + if (!Str::startsWith($this->themePath, $path)) { |
|
138 | + $tmpPath = Normalize::diskPath($this->themePath . '/' . $path . '.php'); |
|
139 | + } |
|
134 | 140 | } else { // sounds like a object-depended view call from controller or etc |
135 | 141 | // get stack trace of callbacks |
136 | 142 | $calledLog = @debug_backtrace(); |
@@ -138,13 +144,15 @@ discard block |
||
138 | 144 | |
139 | 145 | // lets try to find controller in backtrace |
140 | 146 | foreach ($calledLog as $caller) { |
141 | - if (isset($caller['class']) && Str::startsWith('Apps\Controller\\', $caller['class'])) |
|
142 | - $calledController = (string)$caller['class']; |
|
147 | + if (isset($caller['class']) && Str::startsWith('Apps\Controller\\', $caller['class'])) { |
|
148 | + $calledController = (string)$caller['class']; |
|
149 | + } |
|
143 | 150 | } |
144 | 151 | |
145 | 152 | // depended controller is not founded? Let finish |
146 | - if (!$calledController) |
|
147 | - throw new SyntaxException('View render is failed: callback controller not founded! Call with relative path: ' . $path); |
|
153 | + if (!$calledController) { |
|
154 | + throw new SyntaxException('View render is failed: callback controller not founded! Call with relative path: ' . $path); |
|
155 | + } |
|
148 | 156 | |
149 | 157 | // get controller name |
150 | 158 | $controllerName = Str::sub($calledController, Str::length('Apps\Controller\\' . env_name . '\\')); |
@@ -154,23 +162,26 @@ discard block |
||
154 | 162 | } |
155 | 163 | |
156 | 164 | // check if builded view full path is exist |
157 | - if (File::exist($tmpPath)) |
|
158 | - return $tmpPath; |
|
165 | + if (File::exist($tmpPath)) { |
|
166 | + return $tmpPath; |
|
167 | + } |
|
159 | 168 | |
160 | 169 | // hmm, not founded. Lets try to find in caller directory (for widgets, apps packages and other) |
161 | 170 | if ($source !== null) { |
162 | 171 | $tmpPath = Normalize::diskPath($source . DIRECTORY_SEPARATOR . $path . '.php'); |
163 | 172 | if (File::exist($tmpPath)) { |
164 | 173 | // add notify for native views |
165 | - if (App::$Debug) |
|
166 | - App::$Debug->addMessage('Render native viewer: ' . Str::replace(root, null, $tmpPath), 'info'); |
|
174 | + if (App::$Debug) { |
|
175 | + App::$Debug->addMessage('Render native viewer: ' . Str::replace(root, null, $tmpPath), 'info'); |
|
176 | + } |
|
167 | 177 | |
168 | 178 | return $tmpPath; |
169 | 179 | } |
170 | 180 | } |
171 | 181 | |
172 | - if (App::$Debug) |
|
173 | - App::$Debug->addMessage('Viewer not founded on rendering: ' . $path, 'warning'); |
|
182 | + if (App::$Debug) { |
|
183 | + App::$Debug->addMessage('Viewer not founded on rendering: ' . $path, 'warning'); |
|
184 | + } |
|
174 | 185 | |
175 | 186 | return null; |
176 | 187 | } |
@@ -193,8 +204,9 @@ discard block |
||
193 | 204 | */ |
194 | 205 | protected function renderSandbox($path, $params = null) |
195 | 206 | { |
196 | - if (!$path || !File::exist($path)) |
|
197 | - return null; |
|
207 | + if (!$path || !File::exist($path)) { |
|
208 | + return null; |
|
209 | + } |
|
198 | 210 | |
199 | 211 | // render defaults params as variables |
200 | 212 | if (Any::isArray($params) && count($params) > 0) { |
@@ -218,8 +230,9 @@ discard block |
||
218 | 230 | ob_end_clean(); |
219 | 231 | // prepare output message |
220 | 232 | $msg = $e->getMessage(); |
221 | - if (!Str::likeEmpty($msg)) |
|
222 | - $msg .= '. '; |
|
233 | + if (!Str::likeEmpty($msg)) { |
|
234 | + $msg .= '. '; |
|
235 | + } |
|
223 | 236 | |
224 | 237 | $msg .= __('Native exception catched in view: %path% in line %line%', ['path' => $path, 'line' => $e->getLine()]); |
225 | 238 | exit($e->display($msg)); |
@@ -255,8 +268,9 @@ discard block |
||
255 | 268 | { |
256 | 269 | $items = App::$Alias->getCustomLibraryArray($type); |
257 | 270 | // check if custom library available |
258 | - if (!$items || !Any::isArray($items) || count($items) < 1) |
|
259 | - return null; |
|
271 | + if (!$items || !Any::isArray($items) || count($items) < 1) { |
|
272 | + return null; |
|
273 | + } |
|
260 | 274 | |
261 | 275 | $output = []; |
262 | 276 | foreach ($items as $item) { |
@@ -290,8 +304,9 @@ discard block |
||
290 | 304 | */ |
291 | 305 | public function showPlainCode(?string $type = null): ?string |
292 | 306 | { |
293 | - if (!App::$Alias->getPlainCode($type) || !Any::isArray(App::$Alias->getPlainCode($type))) |
|
294 | - return null; |
|
307 | + if (!App::$Alias->getPlainCode($type) || !Any::isArray(App::$Alias->getPlainCode($type))) { |
|
308 | + return null; |
|
309 | + } |
|
295 | 310 | |
296 | 311 | $code = null; |
297 | 312 | foreach (App::$Alias->getPlainCode($type) as $row) { |
@@ -7,7 +7,6 @@ |
||
7 | 7 | use Ffcms\Core\Helper\HTML\System\NativeGenerator; |
8 | 8 | use Ffcms\Core\Helper\Type\Any; |
9 | 9 | use Ffcms\Core\Helper\Type\Arr; |
10 | -use Ffcms\Core\Helper\Type\Obj; |
|
11 | 10 | use Ffcms\Core\Helper\Type\Str; |
12 | 11 | |
13 | 12 | class Nav extends NativeGenerator |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | } elseif ($item['type'] === 'tab') { |
60 | 60 | $activeObject = false; |
61 | 61 | $item['type'] = 'link'; // fix for global Listing builder |
62 | - $item['link'] = '#' . $elements['tabAnchor'] . $tabIdx; |
|
62 | + $item['link'] = '#'.$elements['tabAnchor'].$tabIdx; |
|
63 | 63 | |
64 | 64 | $item['property']['role'] = 'presentation'; |
65 | 65 | |
@@ -74,10 +74,10 @@ discard block |
||
74 | 74 | |
75 | 75 | // mark active tab |
76 | 76 | if ($activeObject === true) |
77 | - $item['property']['class'] .= (Str::length($item['property']['class']) > 0 ? ' ' : null) . 'active'; |
|
77 | + $item['property']['class'] .= (Str::length($item['property']['class']) > 0 ? ' ' : null).'active'; |
|
78 | 78 | |
79 | 79 | // tab special properties for bootstrap |
80 | - $item['linkProperty']['aria-controls'] = $elements['tabAnchor'] . $tabIdx; |
|
80 | + $item['linkProperty']['aria-controls'] = $elements['tabAnchor'].$tabIdx; |
|
81 | 81 | $item['linkProperty']['role'] = 'tab'; |
82 | 82 | $item['linkProperty']['data-toggle'] = 'tab'; |
83 | 83 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | } else { |
97 | 97 | return self::nohtml($itemContent); |
98 | 98 | } |
99 | - }, ['role' => 'tabpanel', 'class' => 'tab-pane fade' . ($activeObject === true ? ' in active' : null), 'id' => $elements['tabAnchor'] . $tabIdx]); |
|
99 | + }, ['role' => 'tabpanel', 'class' => 'tab-pane fade'.($activeObject === true ? ' in active' : null), 'id' => $elements['tabAnchor'].$tabIdx]); |
|
100 | 100 | $tabIdx++; |
101 | 101 | } |
102 | 102 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | // check if global class "nav" isset |
105 | 105 | if ($elements['property']['class'] !== null) { |
106 | 106 | if (!Str::contains('nav ', $elements['property']['class'])) { |
107 | - $elements['property']['class'] = 'nav ' . $elements['property']['class']; |
|
107 | + $elements['property']['class'] = 'nav '.$elements['property']['class']; |
|
108 | 108 | } |
109 | 109 | } else { |
110 | 110 | $elements['property']['class'] = 'nav'; |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | return $tabContent; |
129 | 129 | }, $elements['tabProperty']); |
130 | 130 | } |
131 | - return $listing . $tabContent; |
|
131 | + return $listing.$tabContent; |
|
132 | 132 | }, $blockProperty); |
133 | 133 | } |
134 | 134 | } |
135 | 135 | \ No newline at end of file |
@@ -20,18 +20,21 @@ discard block |
||
20 | 20 | public static function display(array $elements): ?string |
21 | 21 | { |
22 | 22 | // check if elements isn't empty and contains rows |
23 | - if (!isset($elements['items']) || count($elements['items']) < 1) |
|
24 | - return null; |
|
23 | + if (!isset($elements['items']) || count($elements['items']) < 1) { |
|
24 | + return null; |
|
25 | + } |
|
25 | 26 | |
26 | 27 | // prepare tab order |
27 | - if ($elements['tabAnchor'] === null) |
|
28 | - $elements['tabAnchor'] = Str::randomLatin(mt_rand(6, 12)); |
|
28 | + if ($elements['tabAnchor'] === null) { |
|
29 | + $elements['tabAnchor'] = Str::randomLatin(mt_rand(6, 12)); |
|
30 | + } |
|
29 | 31 | |
30 | 32 | // set global element properties |
31 | 33 | $blockProperty = []; |
32 | 34 | if ($elements['blockProperty'] !== null) { |
33 | - if (Any::isArray($elements['blockProperty'])) |
|
34 | - $blockProperty = $elements['blockProperty']; |
|
35 | + if (Any::isArray($elements['blockProperty'])) { |
|
36 | + $blockProperty = $elements['blockProperty']; |
|
37 | + } |
|
35 | 38 | unset($elements['blockProperty']); |
36 | 39 | } |
37 | 40 | |
@@ -73,8 +76,9 @@ discard block |
||
73 | 76 | } |
74 | 77 | |
75 | 78 | // mark active tab |
76 | - if ($activeObject === true) |
|
77 | - $item['property']['class'] .= (Str::length($item['property']['class']) > 0 ? ' ' : null) . 'active'; |
|
79 | + if ($activeObject === true) { |
|
80 | + $item['property']['class'] .= (Str::length($item['property']['class']) > 0 ? ' ' : null) . 'active'; |
|
81 | + } |
|
78 | 82 | |
79 | 83 | // tab special properties for bootstrap |
80 | 84 | $item['linkProperty']['aria-controls'] = $elements['tabAnchor'] . $tabIdx; |
@@ -48,7 +48,7 @@ |
||
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
51 | - * @param string|array $name |
|
51 | + * @param string $name |
|
52 | 52 | * @param string|array|null $value |
53 | 53 | * @param array|null $properties |
54 | 54 | * @return null|string |
@@ -4,9 +4,7 @@ |
||
4 | 4 | |
5 | 5 | use Ffcms\Core\App; |
6 | 6 | use Ffcms\Core\Arch\Model; |
7 | -use Ffcms\Core\Exception\SyntaxException; |
|
8 | 7 | use Ffcms\Core\Helper\Type\Any; |
9 | -use Ffcms\Core\Helper\Type\Obj; |
|
10 | 8 | use Ffcms\Core\Helper\Type\Str; |
11 | 9 | |
12 | 10 | /** |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | break; |
108 | 108 | default: |
109 | 109 | if (App::$Debug) |
110 | - App::$Debug->addMessage('Field has unknown type: ' . App::$Security->strip_tags($name)); |
|
110 | + App::$Debug->addMessage('Field has unknown type: '.App::$Security->strip_tags($name)); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | return $builder->make(); |
@@ -157,12 +157,12 @@ discard block |
||
157 | 157 | if (Str::contains('.', $name)) { |
158 | 158 | $splitedName = explode('.', $name); |
159 | 159 | foreach ($splitedName as $nameKey) { |
160 | - $properties['name'] .= '[' . $nameKey . ']'; |
|
161 | - $properties['id'] .= '-' . $nameKey; |
|
160 | + $properties['name'] .= '['.$nameKey.']'; |
|
161 | + $properties['id'] .= '-'.$nameKey; |
|
162 | 162 | } |
163 | 163 | } else { // standard property definition - add field name |
164 | - $properties['name'] .= '[' . $name . ']'; |
|
165 | - $properties['id'] .= '-' . $name; |
|
164 | + $properties['name'] .= '['.$name.']'; |
|
165 | + $properties['id'] .= '-'.$name; |
|
166 | 166 | } |
167 | 167 | } |
168 | 168 | } |
169 | 169 | \ No newline at end of file |
@@ -56,8 +56,9 @@ discard block |
||
56 | 56 | public function makeTag($name, $value = null, ?array $properties = null): ?string |
57 | 57 | { |
58 | 58 | // check if properties is passed well |
59 | - if ($properties !== null && !Any::isArray($properties)) |
|
60 | - return null; |
|
59 | + if ($properties !== null && !Any::isArray($properties)) { |
|
60 | + return null; |
|
61 | + } |
|
61 | 62 | |
62 | 63 | // add properties to autovalidation by js (properties passed by ref) |
63 | 64 | $this->addValidationProperties($name, $properties); |
@@ -106,8 +107,9 @@ discard block |
||
106 | 107 | $builder = new RadioField($properties, $name, $value); |
107 | 108 | break; |
108 | 109 | default: |
109 | - if (App::$Debug) |
|
110 | - App::$Debug->addMessage('Field has unknown type: ' . App::$Security->strip_tags($name)); |
|
110 | + if (App::$Debug) { |
|
111 | + App::$Debug->addMessage('Field has unknown type: ' . App::$Security->strip_tags($name)); |
|
112 | + } |
|
111 | 113 | } |
112 | 114 | |
113 | 115 | return $builder->make(); |
@@ -150,8 +152,9 @@ discard block |
||
150 | 152 | { |
151 | 153 | // standard property data definition |
152 | 154 | $properties['name'] = $properties['id'] = $this->formName; // form global name |
153 | - if ($value !== null && !Any::isEmpty($value)) |
|
154 | - $properties['value'] = $value; |
|
155 | + if ($value !== null && !Any::isEmpty($value)) { |
|
156 | + $properties['value'] = $value; |
|
157 | + } |
|
155 | 158 | |
156 | 159 | // sounds like a array-path based obj name |
157 | 160 | if (Str::contains('.', $name)) { |
@@ -6,7 +6,6 @@ |
||
6 | 6 | use Ffcms\Core\Helper\HTML\System\NativeGenerator; |
7 | 7 | use Ffcms\Core\Helper\Type\Any; |
8 | 8 | use Ffcms\Core\Helper\Type\Arr; |
9 | -use Ffcms\Core\Helper\Type\Obj; |
|
10 | 9 | |
11 | 10 | /** |
12 | 11 | * Class MultiCheckboxField. Make multiple checkboxes form field |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | // check if options is defined |
44 | 44 | $options = $this->properties['options']; |
45 | 45 | if (!Any::isIterable($options)) |
46 | - throw new SyntaxException('Options for field ' . self::nohtml($this->name) . ' is not iterable'); |
|
46 | + throw new SyntaxException('Options for field '.self::nohtml($this->name).' is not iterable'); |
|
47 | 47 | |
48 | 48 | unset($this->properties['options']); |
49 | 49 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $this->properties['value'] = $opt; |
65 | 65 | // apply structured checkboxes style for each item |
66 | 66 | $build .= App::$View->render('native/form/multi_checkboxes_list', [ |
67 | - 'item' => self::buildSingleTag('input', $this->properties) . self::nohtml($opt) |
|
67 | + 'item' => self::buildSingleTag('input', $this->properties).self::nohtml($opt) |
|
68 | 68 | ]); |
69 | 69 | } |
70 | 70 |
@@ -42,8 +42,9 @@ |
||
42 | 42 | { |
43 | 43 | // check if options is defined |
44 | 44 | $options = $this->properties['options']; |
45 | - if (!Any::isIterable($options)) |
|
46 | - throw new SyntaxException('Options for field ' . self::nohtml($this->name) . ' is not iterable'); |
|
45 | + if (!Any::isIterable($options)) { |
|
46 | + throw new SyntaxException('Options for field ' . self::nohtml($this->name) . ' is not iterable'); |
|
47 | + } |
|
47 | 48 | |
48 | 49 | unset($this->properties['options']); |
49 | 50 |
@@ -5,7 +5,6 @@ |
||
5 | 5 | use Ffcms\Core\Helper\HTML\System\NativeGenerator; |
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 | |
10 | 9 | class MultiSelectField extends NativeGenerator implements iField |
11 | 10 | { |
@@ -37,7 +37,7 @@ |
||
37 | 37 | $options = $this->properties['options']; |
38 | 38 | $optionsKey = (bool)$this->properties['optionsKey']; |
39 | 39 | if (!Any::isIterable($options)) |
40 | - throw new SyntaxException('Options for field ' . self::nohtml($this->name) . ' is not iterable'); |
|
40 | + throw new SyntaxException('Options for field '.self::nohtml($this->name).' is not iterable'); |
|
41 | 41 | |
42 | 42 | unset($this->properties['options']); |
43 | 43 |
@@ -36,8 +36,9 @@ discard block |
||
36 | 36 | // check if options is defined |
37 | 37 | $options = $this->properties['options']; |
38 | 38 | $optionsKey = (bool)$this->properties['optionsKey']; |
39 | - if (!Any::isIterable($options)) |
|
40 | - throw new SyntaxException('Options for field ' . self::nohtml($this->name) . ' is not iterable'); |
|
39 | + if (!Any::isIterable($options)) { |
|
40 | + throw new SyntaxException('Options for field ' . self::nohtml($this->name) . ' is not iterable'); |
|
41 | + } |
|
41 | 42 | |
42 | 43 | unset($this->properties['options']); |
43 | 44 | |
@@ -56,11 +57,13 @@ discard block |
||
56 | 57 | if ($optionsKey === true) { |
57 | 58 | $optionProperty['value'] = $val; |
58 | 59 | // check if current element is active |
59 | - if (Any::isArray($this->value) && Arr::in((string)$val, $this->value)) |
|
60 | - $optionProperty['selected'] = 'selected'; |
|
60 | + if (Any::isArray($this->value) && Arr::in((string)$val, $this->value)) { |
|
61 | + $optionProperty['selected'] = 'selected'; |
|
62 | + } |
|
61 | 63 | } else { |
62 | - if (Any::isArray($this->value) && Arr::in((string)$text, $this->value)) |
|
63 | - $optionProperty['selected'] = 'selected'; |
|
64 | + if (Any::isArray($this->value) && Arr::in((string)$text, $this->value)) { |
|
65 | + $optionProperty['selected'] = 'selected'; |
|
66 | + } |
|
64 | 67 | } |
65 | 68 | $optionsDOM .= self::buildContainerTag('option', $optionProperty, $text); |
66 | 69 | } |