@@ -32,10 +32,10 @@ |
||
| 32 | 32 | { |
| 33 | 33 | parent::__construct('textarea'); |
| 34 | 34 | |
| 35 | - if (isset($attributes[ 'id' ])) { |
|
| 36 | - $this->entity->setEntityName('textarea-' . $attributes[ 'id' ]); |
|
| 37 | - } elseif (isset($attributes[ 'name' ])) { |
|
| 38 | - $this->entity->setEntityName('textarea-' . $attributes[ 'name' ]); |
|
| 35 | + if (isset($attributes['id'])) { |
|
| 36 | + $this->entity->setEntityName('textarea-' . $attributes['id']); |
|
| 37 | + } elseif (isset($attributes['name'])) { |
|
| 38 | + $this->entity->setEntityName('textarea-' . $attributes['name']); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | if (count($attributes)) { |
@@ -36,10 +36,10 @@ |
||
| 36 | 36 | { |
| 37 | 37 | parent::__construct('select'); |
| 38 | 38 | |
| 39 | - if (isset($attributes[ 'id' ])) { |
|
| 40 | - $this->entity->setEntityName('select-' . $attributes[ 'id' ]); |
|
| 41 | - } elseif (isset($attributes[ 'name' ])) { |
|
| 42 | - $this->entity->setEntityName('select-' . $attributes[ 'name' ]); |
|
| 39 | + if (isset($attributes['id'])) { |
|
| 40 | + $this->entity->setEntityName('select-' . $attributes['id']); |
|
| 41 | + } elseif (isset($attributes['name'])) { |
|
| 42 | + $this->entity->setEntityName('select-' . $attributes['name']); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | if (count($attributes)) { |
@@ -28,10 +28,10 @@ |
||
| 28 | 28 | { |
| 29 | 29 | parent::__construct('label'); |
| 30 | 30 | |
| 31 | - if (isset($attributes[ 'id' ])) { |
|
| 32 | - $this->entity->setEntityName('label-' . $attributes[ 'id' ]); |
|
| 33 | - } elseif (isset($attributes[ 'for' ])) { |
|
| 34 | - $this->entity->setEntityName('label-' . $attributes[ 'name' ]); |
|
| 31 | + if (isset($attributes['id'])) { |
|
| 32 | + $this->entity->setEntityName('label-' . $attributes['id']); |
|
| 33 | + } elseif (isset($attributes['for'])) { |
|
| 34 | + $this->entity->setEntityName('label-' . $attributes['name']); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | if (count($attributes)) { |
@@ -55,8 +55,8 @@ |
||
| 55 | 55 | */ |
| 56 | 56 | public function createInput(array $attributes = []) |
| 57 | 57 | { |
| 58 | - if (isset($attributes[ 'type' ])) { |
|
| 59 | - switch ($attributes[ 'type' ]) { |
|
| 58 | + if (isset($attributes['type'])) { |
|
| 59 | + switch ($attributes['type']) { |
|
| 60 | 60 | default: |
| 61 | 61 | $input = new Form\Elements\Input($attributes); |
| 62 | 62 | break; |
@@ -42,10 +42,10 @@ |
||
| 42 | 42 | parent::__construct('button'); |
| 43 | 43 | $this->attributes->addAttribute('type', 'button'); |
| 44 | 44 | |
| 45 | - if (isset($attributes[ 'id' ])) { |
|
| 46 | - $this->entity->setEntityName('btn-' . $attributes[ 'id' ]); |
|
| 47 | - } elseif (isset($attributes[ 'name' ])) { |
|
| 48 | - $this->entity->setEntityName('btn-' . $attributes[ 'name' ]); |
|
| 45 | + if (isset($attributes['id'])) { |
|
| 46 | + $this->entity->setEntityName('btn-' . $attributes['id']); |
|
| 47 | + } elseif (isset($attributes['name'])) { |
|
| 48 | + $this->entity->setEntityName('btn-' . $attributes['name']); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | if (count($attributes)) { |
@@ -28,8 +28,8 @@ |
||
| 28 | 28 | { |
| 29 | 29 | parent::__construct('form'); |
| 30 | 30 | |
| 31 | - if (isset($attributes[ 'id' ])) { |
|
| 32 | - $this->entity->setEntityName($attributes[ 'id' ]); |
|
| 31 | + if (isset($attributes['id'])) { |
|
| 32 | + $this->entity->setEntityName($attributes['id']); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | if (count($attributes)) { |
@@ -191,13 +191,13 @@ discard block |
||
| 191 | 191 | |
| 192 | 192 | public function setFieldsets(array $fieldsets, $group = 'main') |
| 193 | 193 | { |
| 194 | - $this->fieldsets[ $group ] = $fieldsets; |
|
| 194 | + $this->fieldsets[$group] = $fieldsets; |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | public function setFieldset(array $fieldset, $legend = '', $group = 'main') |
| 198 | 198 | { |
| 199 | 199 | if (array_key_exists($group, $this->fieldsets)) { |
| 200 | - $this->fieldsets[ $group ][ $legend ] = $fieldset; |
|
| 200 | + $this->fieldsets[$group][$legend] = $fieldset; |
|
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | 203 | |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | */ |
| 216 | 216 | public function setFields(array $fields = []) |
| 217 | 217 | { |
| 218 | - $this->fieldsets[ 'blank' ][ 'fields' ] = $fields; |
|
| 218 | + $this->fieldsets['blank']['fields'] = $fields; |
|
| 219 | 219 | |
| 220 | 220 | return $this; |
| 221 | 221 | } |
@@ -247,40 +247,40 @@ discard block |
||
| 247 | 247 | |
| 248 | 248 | public function render() |
| 249 | 249 | { |
| 250 | - $panel[ 'header' ] = new Panel(Panel::DEFAULT_PANEL); |
|
| 251 | - $panel[ 'header' ]->setTitle($this->title); |
|
| 252 | - $panel[ 'header' ]->addAttribute('data-role', 'form-panel-header'); |
|
| 250 | + $panel['header'] = new Panel(Panel::DEFAULT_PANEL); |
|
| 251 | + $panel['header']->setTitle($this->title); |
|
| 252 | + $panel['header']->addAttribute('data-role', 'form-panel-header'); |
|
| 253 | 253 | |
| 254 | 254 | foreach ($this->fieldsets as $group => $fieldsets) { |
| 255 | - $panel[ $group ] = new Group(Group::PANEL_GROUP); |
|
| 255 | + $panel[$group] = new Group(Group::PANEL_GROUP); |
|
| 256 | 256 | |
| 257 | 257 | foreach ($fieldsets as $role => $fieldset) { |
| 258 | - $attr = isset($fieldset[ 'attr' ]) ? $fieldset[ 'attr' ] : []; |
|
| 259 | - $attr[ 'data-role' ] = $role; |
|
| 258 | + $attr = isset($fieldset['attr']) ? $fieldset['attr'] : []; |
|
| 259 | + $attr['data-role'] = $role; |
|
| 260 | 260 | |
| 261 | - if (isset($fieldset[ 'collapse' ]) AND $fieldset[ 'collapse' ] === true) { |
|
| 262 | - $attr[ 'data-state' ] = 'collapse'; |
|
| 261 | + if (isset($fieldset['collapse']) AND $fieldset['collapse'] === true) { |
|
| 262 | + $attr['data-state'] = 'collapse'; |
|
| 263 | 263 | } |
| 264 | 264 | |
| 265 | - if (isset($fieldset[ 'type' ])) { |
|
| 266 | - $panel[ $group ]->addItem( |
|
| 267 | - (new Fieldset($fieldset[ 'legend' ], Fieldset::PANEL_FIELDSET)) |
|
| 268 | - ->addItems($fieldset[ 'fields' ]) |
|
| 265 | + if (isset($fieldset['type'])) { |
|
| 266 | + $panel[$group]->addItem( |
|
| 267 | + (new Fieldset($fieldset['legend'], Fieldset::PANEL_FIELDSET)) |
|
| 268 | + ->addItems($fieldset['fields']) |
|
| 269 | 269 | ->setAttributes($attr) |
| 270 | - ->setGroupType($fieldset[ 'type' ])); |
|
| 270 | + ->setGroupType($fieldset['type'])); |
|
| 271 | 271 | } else { |
| 272 | - $panel[ $group ]->addItem( |
|
| 273 | - (new Fieldset($fieldset[ 'legend' ], Fieldset::PANEL_FIELDSET)) |
|
| 274 | - ->addItems($fieldset[ 'fields' ]) |
|
| 272 | + $panel[$group]->addItem( |
|
| 273 | + (new Fieldset($fieldset['legend'], Fieldset::PANEL_FIELDSET)) |
|
| 274 | + ->addItems($fieldset['fields']) |
|
| 275 | 275 | ->setAttributes($attr)); |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | } |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | - if (isset($panel[ 'sidebar' ])) { |
|
| 282 | - $panel[ 'main' ]->addClass('col-sm-8'); |
|
| 283 | - $panel[ 'sidebar' ]->addClass('col-sm-4'); |
|
| 281 | + if (isset($panel['sidebar'])) { |
|
| 282 | + $panel['main']->addClass('col-sm-8'); |
|
| 283 | + $panel['sidebar']->addClass('col-sm-4'); |
|
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | return (new Tag('form', implode(PHP_EOL, $panel), $this->attributes))->render(); |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | |
| 201 | 201 | foreach ($keys as $key) { |
| 202 | 202 | if ($this->exists($key)) { |
| 203 | - $result[ $key ] = $this->get($key, $default); |
|
| 203 | + $result[$key] = $this->get($key, $default); |
|
| 204 | 204 | } |
| 205 | 205 | } |
| 206 | 206 | |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | |
| 309 | 309 | foreach ($values as $key => $value) { |
| 310 | 310 | if ($this->set($key, $value, $ttl)) { |
| 311 | - $result[ $key ] = true; |
|
| 311 | + $result[$key] = true; |
|
| 312 | 312 | } |
| 313 | 313 | } |
| 314 | 314 | |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | public function __construct() |
| 27 | 27 | { |
| 28 | 28 | $config = config()->get('logger'); |
| 29 | - $config[ 'path' ] = PATH_CACHE . 'log' . DIRECTORY_SEPARATOR; |
|
| 29 | + $config['path'] = PATH_CACHE . 'log' . DIRECTORY_SEPARATOR; |
|
| 30 | 30 | |
| 31 | 31 | parent::__construct(new Config($config)); |
| 32 | 32 | } |