Test Setup Failed
Push — master ( 230db4...64ab8d )
by Roberts
03:04
created
src/Support/Interfaces/MenuItemInterface.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -15,31 +15,31 @@
 block discarded – undo
15 15
      * MenuItemInterface constructor.
16 16
      * @param Menu $menu
17 17
      */
18
-    public function __construct( Menu $menu );
18
+    public function __construct(Menu $menu);
19 19
 
20 20
     /**
21 21
      * @param string $link
22 22
      * @return $this
23 23
      */
24
-    public function to( $link );
24
+    public function to($link);
25 25
 
26 26
     /**
27 27
      * @param string $title
28 28
      * @return $this
29 29
      */
30
-    public function title( $title );
30
+    public function title($title);
31 31
 
32 32
     /**
33 33
      * @param Closure $callback
34 34
      * @return $this
35 35
      */
36
-    public function subMenu( Closure $callback );
36
+    public function subMenu(Closure $callback);
37 37
 
38 38
     /**
39 39
      * @param bool $isActive
40 40
      * @return $this
41 41
      */
42
-    public function active( $isActive );
42
+    public function active($isActive);
43 43
 
44 44
     /**
45 45
      * @return string
Please login to merge, or discard this patch.
src/Menu/Renderer/JsonRenderer.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -17,22 +17,22 @@  discard block
 block discarded – undo
17 17
      * @param Menu $menu
18 18
      * @return string
19 19
      */
20
-    public function render( Menu $menu )
20
+    public function render(Menu $menu)
21 21
     {
22
-        return json_encode( $this->renderMenu( $menu ) );
22
+        return json_encode($this->renderMenu($menu));
23 23
     }
24 24
 
25 25
     /**
26 26
      * @param Menu $menu
27 27
      * @return array
28 28
      */
29
-    protected function renderMenu( Menu $menu )
29
+    protected function renderMenu(Menu $menu)
30 30
     {
31 31
         $items = [ ];
32 32
 
33
-        foreach( $menu->items() as $item )
33
+        foreach ($menu->items() as $item)
34 34
         {
35
-            $items[] = $this->renderItem( $item );
35
+            $items[ ] = $this->renderItem($item);
36 36
         }
37 37
 
38 38
         return $items;
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
      * @param MenuItemInterface $item
43 43
      * @return array
44 44
      */
45
-    protected function renderItem( MenuItemInterface $item )
45
+    protected function renderItem(MenuItemInterface $item)
46 46
     {
47 47
         /**
48 48
          * @var $item Item
@@ -53,24 +53,24 @@  discard block
 block discarded – undo
53 53
             'active' => $item->isActive(),
54 54
         ];
55 55
 
56
-        if( $item->hasSubMenu() )
56
+        if ($item->hasSubMenu())
57 57
         {
58
-            $menuItem['children'] = $this->renderMenu( $item->getSubMenu() );
58
+            $menuItem[ 'children' ] = $this->renderMenu($item->getSubMenu());
59 59
         }
60 60
 
61
-        if( $item->hasBadge() )
61
+        if ($item->hasBadge())
62 62
         {
63
-            $menuItem['badge'] = $this->renderBadge( $item->getBadge() );
63
+            $menuItem[ 'badge' ] = $this->renderBadge($item->getBadge());
64 64
         }
65 65
 
66
-        return array_filter( $menuItem );
66
+        return array_filter($menuItem);
67 67
     }
68 68
 
69 69
     /**
70 70
      * @param Badge $badge
71 71
      * @return array
72 72
      */
73
-    protected function renderBadge( Badge $badge )
73
+    protected function renderBadge(Badge $badge)
74 74
     {
75 75
         return [
76 76
             'value' => $badge->value(),
Please login to merge, or discard this patch.
src/Menu/Item.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      * Item constructor.
50 50
      * @param Menu $menu
51 51
      */
52
-    public function __construct( Menu $menu )
52
+    public function __construct(Menu $menu)
53 53
     {
54 54
         $this->menu = $menu;
55 55
     }
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      * @param string $link
59 59
      * @return $this
60 60
      */
61
-    public function to( $link )
61
+    public function to($link)
62 62
     {
63 63
         $this->link = $link;
64 64
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
      * @param string $title
70 70
      * @return $this
71 71
      */
72
-    public function title( $title )
72
+    public function title($title)
73 73
     {
74 74
         $this->title = $title;
75 75
 
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
      * @param array $attributes
82 82
      * @return $this
83 83
      */
84
-    public function badge( $value, array $attributes = [ ] )
84
+    public function badge($value, array $attributes = [ ])
85 85
     {
86
-        $this->badge = new Badge( $value, $attributes );
86
+        $this->badge = new Badge($value, $attributes);
87 87
 
88 88
         return $this;
89 89
     }
@@ -92,12 +92,12 @@  discard block
 block discarded – undo
92 92
      * @param Closure $callback
93 93
      * @return $this
94 94
      */
95
-    public function subMenu( Closure $callback )
95
+    public function subMenu(Closure $callback)
96 96
     {
97
-        $this->subMenu = new Menu( null );
98
-        $this->subMenu->setParent( $this );
97
+        $this->subMenu = new Menu(null);
98
+        $this->subMenu->setParent($this);
99 99
 
100
-        $callback( $this->subMenu );
100
+        $callback($this->subMenu);
101 101
 
102 102
         return $this;
103 103
     }
@@ -106,13 +106,13 @@  discard block
 block discarded – undo
106 106
      * @param $isActive
107 107
      * @return $this
108 108
      */
109
-    public function active( $isActive )
109
+    public function active($isActive)
110 110
     {
111 111
         $this->active = $isActive;
112 112
 
113
-        if( $this->menu->hasParent() )
113
+        if ($this->menu->hasParent())
114 114
         {
115
-            $this->menu->parent()->active( true );
115
+            $this->menu->parent()->active(true);
116 116
         }
117 117
 
118 118
         return $this;
Please login to merge, or discard this patch.
src/Menu/Badge.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
      * @param $value
24 24
      * @param array $attributes
25 25
      */
26
-    public function __construct( $value, array $attributes = [ ] )
26
+    public function __construct($value, array $attributes = [ ])
27 27
     {
28 28
         $this->value = $value;
29 29
         $this->attributes = $attributes;
Please login to merge, or discard this patch.
src/Menu/Menu.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
     /**
19 19
      * @var array
20 20
      */
21
-    protected $items = [];
21
+    protected $items = [ ];
22 22
 
23 23
     /**
24 24
      * @var \Roboc\Support\Interfaces\MenuItemInterface
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
      * Menu constructor.
30 30
      * @param string $identifier
31 31
      */
32
-    public function __construct( $identifier )
32
+    public function __construct($identifier)
33 33
     {
34 34
         $this->identifier = $identifier;
35 35
     }
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
      * @param MenuItemInterface $item
39 39
      * @return \Roboc\Support\Interfaces\MenuItemInterface
40 40
      */
41
-    public function add( MenuItemInterface $item )
41
+    public function add(MenuItemInterface $item)
42 42
     {
43
-        $this->items[] = $item;
43
+        $this->items[ ] = $item;
44 44
 
45 45
         return $item;
46 46
     }
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
      * @param string $title
50 50
      * @return Item
51 51
      */
52
-    public function item( $title )
52
+    public function item($title)
53 53
     {
54
-        return $this->add( new Item( $this ) )->title( $title );
54
+        return $this->add(new Item($this))->title($title);
55 55
     }
56 56
 
57 57
     /**
@@ -82,20 +82,20 @@  discard block
 block discarded – undo
82 82
      * @param $link
83 83
      * @return MenuItemInterface
84 84
      */
85
-    public function getItemByLink( $link )
85
+    public function getItemByLink($link)
86 86
     {
87
-        foreach( $this->items() as $item )
87
+        foreach ($this->items() as $item)
88 88
         {
89
-            if( $item->getLink() === $link )
89
+            if ($item->getLink() === $link)
90 90
             {
91 91
                 return $item;
92 92
             }
93 93
 
94
-            if( $item->hasSubMenu() )
94
+            if ($item->hasSubMenu())
95 95
             {
96
-                 $item = $item->getSubMenu()->getItemByLink( $link );
96
+                 $item = $item->getSubMenu()->getItemByLink($link);
97 97
 
98
-                if( $item )
98
+                if ($item)
99 99
                 {
100 100
                     return $item;
101 101
                 }
@@ -108,20 +108,20 @@  discard block
 block discarded – undo
108 108
     /**
109 109
      * @param $link
110 110
      */
111
-    public function setActive( $link )
111
+    public function setActive($link)
112 112
     {
113
-        $item = $this->getItemByLink( $link );
113
+        $item = $this->getItemByLink($link);
114 114
 
115
-        if( $item )
115
+        if ($item)
116 116
         {
117
-            $item->active( true );
117
+            $item->active(true);
118 118
         }
119 119
     }
120 120
 
121 121
     /**
122 122
      * @param MenuItemInterface $item
123 123
      */
124
-    public function setParent( MenuItemInterface $item )
124
+    public function setParent(MenuItemInterface $item)
125 125
     {
126 126
         $this->parent = $item;
127 127
     }
@@ -131,6 +131,6 @@  discard block
 block discarded – undo
131 131
      */
132 132
     public function hasItems()
133 133
     {
134
-        return (bool) count( $this->items );
134
+        return (bool) count($this->items);
135 135
     }
136 136
 }
Please login to merge, or discard this patch.