@@ -12,7 +12,6 @@ |
||
12 | 12 | use Malezha\Menu\Contracts\MenuRender; |
13 | 13 | use Malezha\Menu\Traits\HasActiveAttributes as TraitHasActiveAttributes; |
14 | 14 | use Malezha\Menu\Traits\HasAttributes; |
15 | -use Opis\Closure\SerializableClosure; |
|
16 | 15 | |
17 | 16 | /** |
18 | 17 | * Class Builder |
@@ -2,7 +2,10 @@ |
||
2 | 2 | <?php if ($menu) :?> |
3 | 3 | <<?php echo $menu->getType() . $menu->buildAttributes();?>> |
4 | 4 | <?php foreach ($menu->all() as $element) :?> |
5 | - <?php if ($element instanceof \Malezha\Menu\Contracts\ElementFactory) $element = $element->build(); ?> |
|
5 | + <?php if ($element instanceof \Malezha\Menu\Contracts\ElementFactory) { |
|
6 | + $element = $element->build(); |
|
7 | +} |
|
8 | +?> |
|
6 | 9 | <?php echo $element->render($renderView);?> |
7 | 10 | <?php endforeach;?> |
8 | 11 | </<?php echo $menu->getType();?>> |
@@ -148,9 +148,9 @@ discard block |
||
148 | 148 | $builder = $this->builderFactory(); |
149 | 149 | |
150 | 150 | $builder->create('index', Link::class, |
151 | - function (LinkFactory $factory) {}); |
|
151 | + function(LinkFactory $factory) {}); |
|
152 | 152 | $builder->create('index', SubMenu::class, |
153 | - function (SubMenuFactory $factory) {}); // Duplicate |
|
153 | + function(SubMenuFactory $factory) {}); // Duplicate |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | public function testGet() |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $builder = $this->builderFactory(); |
159 | 159 | |
160 | 160 | $item = $builder->create('test', Link::class, |
161 | - function (LinkFactory $factory) {}); |
|
161 | + function(LinkFactory $factory) {}); |
|
162 | 162 | |
163 | 163 | $this->assertEquals($item, $builder->get('test')); |
164 | 164 | $this->assertEquals(null, $builder->get('notFound')); |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | $builder = $this->builderFactory(); |
172 | 172 | |
173 | 173 | $item = $builder->create('test', Link::class, |
174 | - function (LinkFactory $factory) {}); |
|
174 | + function(LinkFactory $factory) {}); |
|
175 | 175 | |
176 | 176 | $this->assertEquals($item, $builder->getByIndex(0)); |
177 | 177 | $this->assertEquals(null, $builder->getByIndex(1)); |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | |
203 | 203 | $this->assertEquals([], $builder->all()); |
204 | 204 | $item = $builder->create('test', Link::class, |
205 | - function (LinkFactory $factory) {}); |
|
205 | + function(LinkFactory $factory) {}); |
|
206 | 206 | $this->assertEquals(['test' => $item], $builder->all()); |
207 | 207 | } |
208 | 208 | |
@@ -211,9 +211,9 @@ discard block |
||
211 | 211 | $builder = $this->builderFactory(); |
212 | 212 | |
213 | 213 | $builder->create('test', Link::class, |
214 | - function (LinkFactory $factory) {}); |
|
214 | + function(LinkFactory $factory) {}); |
|
215 | 215 | $builder->create('another', Text::class, |
216 | - function (TextFactory $factory) {}); |
|
216 | + function(TextFactory $factory) {}); |
|
217 | 217 | |
218 | 218 | $this->assertTrue($builder->has('test')); |
219 | 219 | $builder->forget('test'); |
@@ -348,14 +348,14 @@ discard block |
||
348 | 348 | $factory->url = url('logout'); |
349 | 349 | }); |
350 | 350 | |
351 | - $builder->insertAfter('index', function (Builder $builder) { |
|
351 | + $builder->insertAfter('index', function(Builder $builder) { |
|
352 | 352 | $builder->create('users', Link::class, function(LinkFactory $factory) { |
353 | 353 | $factory->title = 'Users'; |
354 | 354 | $factory->url = url('users'); |
355 | 355 | }); |
356 | 356 | }); |
357 | 357 | |
358 | - $builder->insertBefore('users', function (Builder $builder) { |
|
358 | + $builder->insertBefore('users', function(Builder $builder) { |
|
359 | 359 | $builder->create('profile', Link::class, function(LinkFactory $factory) { |
360 | 360 | $factory->title = 'Profile'; |
361 | 361 | $factory->url = url('profile'); |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | $this->expectException(\RuntimeException::class); |
371 | 371 | |
372 | 372 | $builder = $this->builderFactory(); |
373 | - $builder->insertBefore('not_exist', function (Builder $builder) {}); |
|
373 | + $builder->insertBefore('not_exist', function(Builder $builder) {}); |
|
374 | 374 | } |
375 | 375 | |
376 | 376 | public function testInsertExceptionDuplicate() |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | $factory->title = 'Some'; |
387 | 387 | $factory->url = '/'; |
388 | 388 | }); |
389 | - $builder->insertAfter('home', function (Builder $builder) { |
|
389 | + $builder->insertAfter('home', function(Builder $builder) { |
|
390 | 390 | $builder->create('some', Text::class, function(TextFactory $factory) { |
391 | 391 | $factory->text = 'Duplicate some'; |
392 | 392 | }); |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | }); |
426 | 426 | }); |
427 | 427 | $builder->create('settings', Link::class, function(LinkFactory $factory) { |
428 | - $factory->displayRule = function () {return false;}; |
|
428 | + $factory->displayRule = function() {return false; }; |
|
429 | 429 | $factory->title = 'Settings'; |
430 | 430 | $factory->url = url('/settings'); |
431 | 431 | }); |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php if ($menu) :?> |
2 | - <<?= $menu->getType() . $menu->buildAttributes();?>> |
|
2 | + <<?= $menu->getType() . $menu->buildAttributes(); ?>> |
|
3 | 3 | <?php foreach ($menu->all() as $element) :?> |
4 | 4 | <?php if ($element instanceof \Malezha\Menu\Contracts\ElementFactory) $element = $element->build(); ?> |
5 | - <?= $element->render($renderView);?> |
|
6 | - <?php endforeach;?> |
|
7 | - </<?= $menu->getType();?>> |
|
8 | -<?php endif;?> |
|
9 | 5 | \ No newline at end of file |
6 | + <?= $element->render($renderView); ?> |
|
7 | + <?php endforeach; ?> |
|
8 | + </<?= $menu->getType(); ?>> |
|
9 | +<?php endif; ?> |
|
10 | 10 | \ No newline at end of file |
@@ -1,7 +1,10 @@ |
||
1 | 1 | <?php if ($menu) :?> |
2 | 2 | <<?= $menu->getType() . $menu->buildAttributes();?>> |
3 | 3 | <?php foreach ($menu->all() as $element) :?> |
4 | - <?php if ($element instanceof \Malezha\Menu\Contracts\ElementFactory) $element = $element->build(); ?> |
|
4 | + <?php if ($element instanceof \Malezha\Menu\Contracts\ElementFactory) { |
|
5 | + $element = $element->build(); |
|
6 | +} |
|
7 | +?> |
|
5 | 8 | <?= $element->render($renderView);?> |
6 | 9 | <?php endforeach;?> |
7 | 10 | </<?= $menu->getType();?>> |