1 | <?php declare(strict_types=1); |
||
21 | final class AsyncClient implements AsyncClientInterface |
||
22 | { |
||
23 | /** |
||
24 | * @var ClientInterface |
||
25 | */ |
||
26 | private $client; |
||
27 | 9 | ||
28 | /** |
||
29 | 9 | * @param ClientInterface $client |
|
30 | 9 | */ |
|
31 | private function __construct(ClientInterface $client) |
||
35 | |||
36 | /** |
||
37 | * Create a new AsyncClient based on the loop and other options pass. |
||
38 | * |
||
39 | * @param LoopInterface $loop |
||
40 | 1 | * @param string $token Instructions to fetch the token: https://blog.travis-ci.com/2013-01-28-token-token-token/ |
|
41 | * @param array $options |
||
42 | * @return AsyncClient |
||
43 | */ |
||
44 | public static function create( |
||
61 | |||
62 | public function hydrate(array $resource) |
||
68 | |||
69 | public function extract(ResourceInterface $resource) |
||
81 | |||
82 | /** |
||
83 | * Create an AsyncClient from a ApiClients\Foundation\ClientInterface. |
||
84 | * Be sure to pass in a client with the options from ApiSettings and the Async namespace suffix. |
||
85 | * |
||
86 | * @param ClientInterface $client |
||
87 | * @return AsyncClient |
||
88 | */ |
||
89 | public static function createFromClient(ClientInterface $client): self |
||
93 | |||
94 | /** |
||
95 | * {@inheritdoc} |
||
96 | */ |
||
97 | public function repository(string $repository): CancellablePromiseInterface |
||
101 | |||
102 | /** |
||
103 | * Warning this a intensive operation as it has to make a call for each hook |
||
104 | * to turn it into a Repository!!! |
||
105 | * |
||
106 | * Take a look at examples/repositories-async.php on how to limit the amount of |
||
107 | 1 | * concurrent requests. |
|
108 | * |
||
109 | 1 | * {@inheritdoc} |
|
110 | */ |
||
111 | public function repositories(callable $filter = null): ObservableInterface |
||
127 | |||
128 | /** |
||
129 | * {@inheritdoc} |
||
130 | */ |
||
131 | public function user(): PromiseInterface |
||
135 | 1 | ||
136 | 1 | /** |
|
137 | * {@inheritdoc} |
||
138 | */ |
||
139 | public function sshKey(int $id): PromiseInterface |
||
143 | 1 | ||
144 | /** |
||
145 | 1 | * @return ObservableInterface |
|
146 | 1 | */ |
|
147 | public function hooks(): ObservableInterface |
||
153 | |||
154 | /** |
||
155 | * {@inheritdoc} |
||
156 | */ |
||
157 | public function accounts(): ObservableInterface |
||
163 | |||
164 | /** |
||
165 | * {@inheritdoc} |
||
166 | */ |
||
167 | public function broadcasts(): ObservableInterface |
||
173 | } |
||
174 |
Let’s assume that you have a directory layout like this:
and let’s assume the following content of
Bar.php
:If both files
OtherDir/Foo.php
andSomeDir/Foo.php
are loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as
OtherDir/Foo.php
does not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php
, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: