1 | <?php |
||
16 | final class Client implements ClientInterface |
||
17 | { |
||
18 | /** |
||
19 | * @var LoopInterface |
||
20 | */ |
||
21 | private $loop; |
||
22 | |||
23 | /** |
||
24 | * @var AsyncClientInterface |
||
25 | */ |
||
26 | private $asyncClient; |
||
27 | |||
28 | /** |
||
29 | * @param string $token |
||
30 | * @param array $options |
||
31 | * @return Client |
||
32 | */ |
||
33 | 1 | public static function create( |
|
43 | |||
44 | /** |
||
45 | * @param LoopInterface $loop |
||
46 | * @param AsyncClientInterface $asyncClient |
||
47 | * @return Client |
||
48 | */ |
||
49 | public static function createFromClient(LoopInterface $loop, AsyncClientInterface $asyncClient): self |
||
53 | |||
54 | /** |
||
55 | * Client constructor. |
||
56 | * @param LoopInterface $loop |
||
57 | * @param AsyncClientInterface $asyncClient |
||
58 | */ |
||
59 | 6 | private function __construct(LoopInterface $loop, AsyncClientInterface $asyncClient) |
|
64 | |||
65 | /** |
||
66 | * @param string $repository |
||
67 | * @return RepositoryInterface |
||
68 | */ |
||
69 | 1 | public function repository(string $repository): RepositoryInterface |
|
70 | { |
||
71 | 1 | return await( |
|
72 | 1 | $this->asyncClient->repository($repository), |
|
73 | 1 | $this->loop |
|
74 | ); |
||
75 | } |
||
76 | |||
77 | /** |
||
78 | * @return UserInterface |
||
79 | */ |
||
80 | 1 | public function user(): UserInterface |
|
81 | { |
||
82 | 1 | return await( |
|
83 | 1 | $this->asyncClient->user(), |
|
84 | 1 | $this->loop |
|
85 | ); |
||
86 | } |
||
87 | |||
88 | /** |
||
89 | * @param int $id |
||
90 | * @return SSHKeyInterface |
||
91 | */ |
||
92 | 1 | public function sshKey(int $id): SSHKeyInterface |
|
93 | { |
||
94 | 1 | return await( |
|
95 | 1 | $this->asyncClient->sshKey($id), |
|
96 | 1 | $this->loop |
|
97 | ); |
||
98 | } |
||
99 | |||
100 | /** |
||
101 | * @return array |
||
102 | */ |
||
103 | public function hooks(): array |
||
104 | { |
||
105 | 1 | return await( |
|
106 | 1 | Promise::fromObservable( |
|
107 | 1 | $this->asyncClient->hooks()->toArray() |
|
108 | ), |
||
109 | 1 | $this->loop |
|
110 | ); |
||
111 | } |
||
112 | |||
113 | /** |
||
114 | * @return array |
||
115 | */ |
||
116 | public function repositories(): array |
||
125 | |||
126 | /** |
||
127 | * @return array |
||
128 | */ |
||
129 | public function accounts(): array |
||
138 | |||
139 | /** |
||
140 | * @return array |
||
141 | */ |
||
142 | public function broadcasts(): array |
||
151 | } |
||
152 |