Skip to content

Commit b7e1c61

Browse files
committed
Update SidebarManager.php
1 parent bb2a175 commit b7e1c61

File tree

1 file changed

+8
-34
lines changed

1 file changed

+8
-34
lines changed

src/Maatwebsite/Sidebar/SidebarManager.php

Lines changed: 8 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,7 @@ public function isWithoutGroupHeading(): bool
4848
return $this->withoutGroupHeading;
4949
}
5050

51-
/**
52-
* Start grouping our items.
53-
*
54-
* @param string $name
55-
* @param Closure $callback
56-
* @return SidebarGroup
57-
*/
58-
public function group($name, $callback = null)
51+
public function group(string $name, ?Closure $callback = null): SidebarGroup
5952
{
6053
if (!$this->groupExists($name)) {
6154
$group = $this->group->init($name);
@@ -82,12 +75,7 @@ public function group($name, $callback = null)
8275
return $group;
8376
}
8477

85-
/**
86-
* Render the sidebar.
87-
*
88-
* @return string
89-
*/
90-
public function render()
78+
public function render(): string
9179
{
9280
$html = '<ul class="sidebar-menu">';
9381

@@ -106,49 +94,35 @@ public function render()
10694
return $html . '</ul>';
10795
}
10896

109-
/**
110-
* @return bool
111-
*/
112-
public function groupExists($name)
97+
public function groupExists($name): bool
11398
{
11499
return $this->groups->has($this->getNameKey($name));
115100
}
116101

117102
/**
118103
* @return mixed
119104
*/
120-
public function getGroup($name)
105+
public function getGroup(string $name)
121106
{
122107
return $this->groups->get($this->getNameKey($name));
123108
}
124109

125-
public function setGroup($name, $group)
110+
public function setGroup(string $name, SidebarGroup $group): void
126111
{
127112
$this->groups->put($this->getNameKey($name), $group);
128113
}
129114

130-
/**
131-
* When echo'd, render the object to a string.
132-
*
133-
* @return string [description]
134-
*/
135-
public function __toString()
115+
public function __toString(): string
136116
{
137117
return $this->render();
138118
}
139119

140-
/**
141-
* @return string
142-
*/
143-
protected function getNameKey($name)
120+
protected function getNameKey(string $name): string
144121
{
145122
return md5($name);
146123
}
147124

148-
/**
149-
* @return Collection|SidebarGroup[]
150-
*/
151-
public function getGroups()
125+
public function getGroups(): Collection
152126
{
153127
return $this->groups;
154128
}

0 commit comments

Comments
 (0)