-
-
Notifications
You must be signed in to change notification settings - Fork 191
/
Copy pathDock.php
56 lines (43 loc) · 1.09 KB
/
Dock.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
namespace Native\Laravel;
use Native\Laravel\Client\Client;
use Native\Laravel\Menu\Menu;
class Dock
{
public function __construct(protected Client $client) {}
public function menu(Menu $menu)
{
$items = $menu->toArray()['submenu'];
$this->client->post('dock', [
'items' => $items,
]);
}
public function show()
{
$this->client->post('dock/show');
}
public function hide()
{
$this->client->post('dock/hide');
}
public function icon(string $path)
{
$this->client->post('dock/icon', ['path' => $path]);
}
public function bounce(string $type = 'informational')
{
$this->client->post('dock/bounce', ['type' => $type]);
}
public function cancelBounce()
{
$this->client->post('dock/cancel-bounce');
}
public function badge(?string $label = null): ?string
{
if (is_null($label)) {
return $this->client->get('dock/badge');
}
$this->client->post('dock/badge', ['label' => $label]);
return null;
}
}