Skip to content

Commit 1cf8438

Browse files
committedDec 19, 2024·
Consistency
1 parent 1a8151f commit 1cf8438

File tree

6 files changed

+24
-16
lines changed

6 files changed

+24
-16
lines changed
 

‎src/Menu/Items/Checkbox.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@ class Checkbox extends MenuItem
77
protected string $type = 'checkbox';
88

99
public function __construct(
10-
string $label,
10+
protected ?string $label,
1111
protected bool $isChecked = false,
1212
protected ?string $accelerator = null
13-
) {
14-
$this->label = $label;
15-
}
13+
) {}
1614
}

‎src/Menu/Items/Label.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
class Label extends MenuItem
66
{
7-
public function __construct(string $label)
8-
{
9-
$this->label = $label;
10-
}
7+
public function __construct(
8+
protected ?string $label,
9+
protected ?string $accelerator = null
10+
) {}
1111
}

‎src/Menu/Items/Link.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ class Link extends MenuItem
88

99
protected bool $openInBrowser = false;
1010

11-
public function __construct(protected string $url, protected ?string $label, protected ?string $accelerator = null) {}
11+
public function __construct(
12+
protected string $url,
13+
protected ?string $label,
14+
protected ?string $accelerator = null
15+
) {}
1216

1317
public function openInBrowser(bool $openInBrowser = true): self
1418
{

‎src/Menu/Items/Radio.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@ class Radio extends MenuItem
77
protected string $type = 'radio';
88

99
public function __construct(
10-
string $label,
10+
protected ?string $label,
1111
protected bool $isChecked = false,
1212
protected ?string $accelerator = null
13-
) {
14-
$this->label = $label;
15-
}
13+
) {}
1614
}

‎src/Menu/Items/Role.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ class Role extends MenuItem
88
{
99
protected string $type = 'role';
1010

11-
public function __construct(protected RolesEnum $role, protected ?string $label = '') {}
11+
public function __construct(
12+
protected RolesEnum $role,
13+
protected ?string $label = ''
14+
) {}
1215

1316
public function toArray(): array
1417
{

‎src/Menu/MenuBuilder.php

+7-2
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ public function default(): void
3838
);
3939
}
4040

41-
public function label(string $label): Items\Label
41+
public function label(string $label, ?string $hotkey = null): Items\Label
4242
{
43-
return new Items\Label($label);
43+
return new Items\Label($label, $hotkey);
4444
}
4545

4646
public function checkbox(string $label, bool $checked = false, ?string $hotkey = null): Items\Checkbox
@@ -162,4 +162,9 @@ public function hide(?string $label = null): Items\Role
162162
{
163163
return new Items\Role(RolesEnum::HIDE, $label);
164164
}
165+
166+
public function about(?string $label = null): Items\Role
167+
{
168+
return new Items\Role(RolesEnum::ABOUT, $label);
169+
}
165170
}

0 commit comments

Comments
 (0)
Please sign in to comment.