File tree 7 files changed +28
-6
lines changed
7 files changed +28
-6
lines changed Original file line number Diff line number Diff line change
1
+ /.idea
1
2
/vendor
2
3
composer.phar
3
4
composer.lock
Original file line number Diff line number Diff line change @@ -77,9 +77,10 @@ public static function addIconResolvers(array $resolvers)
77
77
*/
78
78
protected function parseAttributes (array $ in )
79
79
{
80
- if (isset ($ in ['icon ' ]) && $ in ['icon ' ] instanceof Icon \IconInterface) {
80
+ if (isset ($ in ['icon ' ]) && $ in ['icon ' ] instanceof Icons \IconInterface) {
81
81
$ this ->icon = $ in ['icon ' ];
82
82
} else {
83
+ /** @var Icons\IconInterface $resolver */
83
84
foreach (static ::$ iconResolvers as $ key => $ resolver ) {
84
85
if (array_key_exists ($ key , $ in )) {
85
86
$ this ->icon = $ resolver ::createFromAttribute ($ in [$ key ]);
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ class Collection
22
22
/**
23
23
* The menu items.
24
24
*
25
- * @var array
25
+ * @var ItemInterface[]
26
26
*/
27
27
protected $ items = [];
28
28
@@ -246,10 +246,13 @@ public function render()
246
246
$ items = '' ;
247
247
$ sorted = $ this ->items ;
248
248
ksort ($ sorted );
249
+
250
+ /** @var ItemInterface $item */
249
251
foreach (array_flatten ($ sorted ) as $ item ) {
250
252
if ($ item === static ::DIVIDER ) $ items .= '<li class="divider"></li> ' ;
251
253
else $ items .= '<li> ' .$ item ->render ().'</li> ' ;
252
254
}
255
+
253
256
return '<ul ' .$ this ->renderAttributes ().'> ' .$ items .'</ul> ' ;
254
257
}
255
258
}
Original file line number Diff line number Diff line change 11
11
12
12
class FontAwesomeStack implements IconInterface
13
13
{
14
+ /**
15
+ * @var IconInterface[]
16
+ */
14
17
protected $ icons ;
18
+
19
+ /**
20
+ * @var string[]
21
+ */
15
22
protected $ classes = ['stack ' ];
16
23
17
24
public function __construct (array $ icons , array $ classes = array ())
Original file line number Diff line number Diff line change 11
11
12
12
interface ItemInterface
13
13
{
14
+ /**
15
+ * Render the item.
16
+ *
17
+ * @return string
18
+ */
14
19
public function render ();
20
+
21
+ /**
22
+ * Get the unique ID string for the item.
23
+ *
24
+ * @return string
25
+ */
26
+ public function getId ();
15
27
}
Original file line number Diff line number Diff line change 9
9
10
10
namespace anlutro \Menu ;
11
11
12
- use Illuminate \Support \Str ;
13
-
14
12
/**
15
13
* A menu submenu item.
16
14
*/
Original file line number Diff line number Diff line change @@ -51,14 +51,14 @@ public function testCustomIconResolver()
51
51
}
52
52
}
53
53
54
- class CustomIcon implements \anlutro \Menu \ItemInterface
54
+ class CustomIcon implements \anlutro \Menu \Icons \IconInterface
55
55
{
56
56
public function render ()
57
57
{
58
58
return 'custom-icon ' ;
59
59
}
60
60
61
- public static function createFromAttribute ()
61
+ public static function createFromAttribute ($ attribute )
62
62
{
63
63
return new static ;
64
64
}
You can’t perform that action at this time.
0 commit comments