@@ -87,11 +87,11 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | public function run() |
| 89 | 89 | { |
| 90 | - if (null === $this->dataProvider){ |
|
| 90 | + if (null === $this->dataProvider) { |
|
| 91 | 91 | throw new InvalidConfigException('Parameter dataProvider is not defined.'); |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - if (null === $this->itemTemplate || !is_string($this->itemTemplate)){ |
|
| 94 | + if (null === $this->itemTemplate || !is_string($this->itemTemplate)) { |
|
| 95 | 95 | throw new InvalidConfigException('Item template is not defined.'); |
| 96 | 96 | } |
| 97 | 97 | |
@@ -118,20 +118,20 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | private function groupLevels(array $models): array |
| 120 | 120 | { |
| 121 | - if (count($models) == 0){ |
|
| 121 | + if (count($models) == 0) { |
|
| 122 | 122 | return []; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | $items = []; |
| 126 | 126 | |
| 127 | 127 | /** @var ActiveRecord $item */ |
| 128 | - for ($i=0; $i < count($models); $i++) { |
|
| 128 | + for ($i = 0; $i < count($models); $i++) { |
|
| 129 | 129 | $item = $models[$i]; |
| 130 | 130 | $items[$item->{$this->primaryKeyName}]['data'] = $item; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | /** @var ActiveRecord $data */ |
| 134 | - foreach($items as $row) { |
|
| 134 | + foreach ($items as $row) { |
|
| 135 | 135 | $data = $row['data']; |
| 136 | 136 | $parentKey = !isset($data->{$this->parentKeyName}) || empty($data->{$this->parentKeyName}) ? 0 : $data->{$this->parentKeyName}; |
| 137 | 137 | $items[$parentKey]['items'][$data->{$this->primaryKeyName}] = &$items[$data->{$this->primaryKeyName}]; |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | */ |
| 148 | 148 | private function renderItems(array $items): string |
| 149 | 149 | { |
| 150 | - if (count($items) == 0){ |
|
| 150 | + if (count($items) == 0) { |
|
| 151 | 151 | return ''; |
| 152 | 152 | } |
| 153 | 153 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | 'data' => $item['data'] |
| 160 | 160 | ], $this->itemTemplateParams)); |
| 161 | 161 | |
| 162 | - if (isset($item['items'])){ |
|
| 162 | + if (isset($item['items'])) { |
|
| 163 | 163 | $contentLi .= $this->renderItems($item['items']); |
| 164 | 164 | } |
| 165 | 165 | $outPut .= Html::tag($this->itemContainerTag, $contentLi, $this->itemContainerOptions); |