Completed
Push — master ( 15f051...29343b )
by Oleg
05:33
created
src/Entity/Attributes.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@
 block discarded – undo
75 75
 
76 76
     /**
77 77
      * @param string $name
78
-     * @param mixed $value
78
+     * @param string $value
79 79
      * @return $this
80 80
      */
81 81
     public function put($name, $value)
Please login to merge, or discard this patch.
tests/BuilderTest.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
         $builder = $this->builderFactory();
35 35
 
36 36
         $item = $builder->add('index', 'Index', url('/'), ['class' => 'main-menu'], ['class' => 'link'],
37
-            function (Item $item) {
37
+            function(Item $item) {
38 38
                 $this->assertAttributeEquals('Index', 'title', $item->getLink());
39 39
                 $item->getLink()->setTitle('Home');
40 40
             });
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         
99 99
         $this->assertInstanceOf(Attributes::class, $activeAttributes);
100 100
 
101
-        $result = $builder->activeAttributes(function ($attributes) {
101
+        $result = $builder->activeAttributes(function($attributes) {
102 102
             $this->assertInstanceOf(Attributes::class, $attributes);
103 103
             
104 104
             return $attributes->get('class');
@@ -111,9 +111,9 @@  discard block
 block discarded – undo
111 111
     {
112 112
         $builder = $this->builderFactory();
113 113
         
114
-        $group = $builder->group('test', function (Item $item) use ($builder) {
114
+        $group = $builder->group('test', function(Item $item) use ($builder) {
115 115
             $this->assertAttributeEquals($builder, 'builder', $item);
116
-        }, function (Builder $menu) use ($builder) {
116
+        }, function(Builder $menu) use ($builder) {
117 117
             $this->assertEquals($builder->activeAttributes()->all(), $menu->activeAttributes()->all());
118 118
         });
119 119
 
@@ -127,18 +127,18 @@  discard block
 block discarded – undo
127 127
         $index = $builder->add('index', 'Index Page', '/');
128 128
         $index->getLink()->getAttributes()->push(['class' => 'menu-link']);
129 129
 
130
-        $builder->group('orders', function ($item) {
130
+        $builder->group('orders', function($item) {
131 131
             $item->getAttributes()->push(['class' => 'child-menu']);
132 132
             
133 133
             $link = $item->getLink();
134 134
             $link->setTitle('Orders');
135 135
             $link->setUrl('javascript:;');
136 136
 
137
-        }, function ($menu) {
137
+        }, function($menu) {
138 138
             $menu->add('all', 'All', '/orders/all');
139 139
             $menu->add('type_1', 'Type 1', '/orders/1', [], ['class' => 'text-color-red']);
140 140
 
141
-            $menu->add('type_2', 'Type 2', '/orders/2', [], [], function ($item) {
141
+            $menu->add('type_2', 'Type 2', '/orders/2', [], [], function($item) {
142 142
                 $item->getLink()->getAttributes()->push(['data-attribute' => 'value']);
143 143
             });
144 144
         });
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
         $builder = $this->builderFactory();
155 155
 
156 156
         $builder->add('index', 'Index Page', '/');
157
-        $builder->add('login', 'Login', '/login')->setDisplayRule(function () {
157
+        $builder->add('login', 'Login', '/login')->setDisplayRule(function() {
158 158
             return true;
159 159
         });
160 160
         $builder->add('admin', 'Admin', '/admin')->setDisplayRule(false);
Please login to merge, or discard this patch.
src/Entity/Item.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,8 +51,7 @@
 block discarded – undo
51 51
     public function buildAttributes($attributes = [])
52 52
     {
53 53
         $attributes = $this->isActive() ?
54
-            Attributes::mergeArrayValues($this->builder->activeAttributes()->all(), $attributes) :
55
-            $attributes;
54
+            Attributes::mergeArrayValues($this->builder->activeAttributes()->all(), $attributes) : $attributes;
56 55
 
57 56
         return $this->attributes->build($attributes);
58 57
     }
Please login to merge, or discard this patch.
src/MenuServiceProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
 
48 48
     protected function registerSingleton()
49 49
     {
50
-        $this->app->singleton('menu', function (Container $app) {
50
+        $this->app->singleton('menu', function(Container $app) {
51 51
             return new Menu($app);
52 52
         });
53 53
         $this->app->alias('menu', MenuContract::class);
Please login to merge, or discard this patch.
src/Menu.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
      */
36 36
     public function make($name, $callback, $type = Builder::UL, $attributes = [], $activeAttributes = [])
37 37
     {
38
-        if(!is_callable($callback)) {
38
+        if (!is_callable($callback)) {
39 39
             throw new \InvalidArgumentException('Argument must be callable');
40 40
         }
41 41
         
Please login to merge, or discard this patch.
src/Traits/DisplayRule.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,9 +20,9 @@
 block discarded – undo
20 20
     public function canDisplay()
21 21
     {
22 22
         if (is_callable($this->rule)) {
23
-            return (bool)call_user_func($this->rule);
23
+            return (bool) call_user_func($this->rule);
24 24
         }
25 25
         
26
-        return (bool)$this->rule;
26
+        return (bool) $this->rule;
27 27
     }
28 28
 }
29 29
\ No newline at end of file
Please login to merge, or discard this patch.
views/view.blade.php 1 patch
Braces   +6 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,12 @@
 block discarded – undo
1 1
 @if ($menu)
2 2
     <{{ $menu->getType() }}{!! $menu->buildAttributes() !!}>
3 3
     @foreach ($menu->all() as $value)
4
-        <?php $isGroup = $value instanceof \Malezha\Menu\Entity\Group; if ($isGroup) $item = $value->item(); else $item = $value; ?>
4
+        <?php $isGroup = $value instanceof \Malezha\Menu\Entity\Group; if ($isGroup) {
5
+    $item = $value->item();
6
+} else {
7
+    $item = $value;
8
+}
9
+?>
5 10
         @if($item->canDisplay())
6 11
         <li{!! $item->buildAttributes() !!}>
7 12
             <a href="{{ $item->getLink()->getUrl() }}"{!! $item->getLink()->buildAttributes() !!}>{!! $item->getLink()->getTitle() !!}</a>
Please login to merge, or discard this patch.
src/Entity/Builder.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -192,6 +192,9 @@
 block discarded – undo
192 192
         return $this->activeAttributes;
193 193
     }
194 194
 
195
+    /**
196
+     * @param string $html
197
+     */
195 198
     protected function minifyHtmlOutput($html)
196 199
     {
197 200
         $search = array(
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
      */
153 153
     public function setType($type)
154 154
     {
155
-        $this->type = (string)$type;
155
+        $this->type = (string) $type;
156 156
     }
157 157
 
158 158
     /**
@@ -195,8 +195,8 @@  discard block
 block discarded – undo
195 195
     protected function minifyHtmlOutput($html)
196 196
     {
197 197
         $search = array(
198
-            '/\>[^\S]+/s',  // strip whitespaces after tags, except space
199
-            '/[^\S]+\</s',  // strip whitespaces before tags, except space
198
+            '/\>[^\S]+/s', // strip whitespaces after tags, except space
199
+            '/[^\S]+\</s', // strip whitespaces before tags, except space
200 200
             '/(\s)+/s'       // shorten multiple whitespace sequences
201 201
         );
202 202
 
Please login to merge, or discard this patch.