1 | <?php declare(strict_types=1); |
||
17 | final class AsyncClient implements AsyncClientInterface |
||
18 | { |
||
19 | /** |
||
20 | * @var ClientInterface |
||
21 | */ |
||
22 | private $client; |
||
23 | |||
24 | /** |
||
25 | * Create a new AsyncClient based on the loop and other options pass |
||
26 | * |
||
27 | * @param LoopInterface $loop |
||
28 | * @param string $token Instructions to fetch the token: https://blog.travis-ci.com/2013-01-28-token-token-token/ |
||
29 | * @param array $options |
||
30 | * @return AsyncClient |
||
31 | */ |
||
32 | 1 | public static function create( |
|
48 | |||
49 | /** |
||
50 | * Create an AsyncClient from a ApiClients\Foundation\ClientInterface. |
||
51 | * Be sure to pass in a client with the options from ApiSettings and the Async namespace suffix. |
||
52 | * |
||
53 | * @param ClientInterface $client |
||
54 | * @return AsyncClient |
||
55 | */ |
||
56 | 8 | public static function createFromClient(ClientInterface $client): self |
|
60 | |||
61 | /** |
||
62 | * @param ClientInterface $client |
||
63 | */ |
||
64 | 9 | private function __construct(ClientInterface $client) |
|
68 | |||
69 | /** |
||
70 | * {@inheritdoc} |
||
71 | */ |
||
72 | 1 | public function repository(string $repository): CancellablePromiseInterface |
|
76 | |||
77 | /** |
||
78 | * Warning this a intensive operation as it has to make a call for each hook |
||
79 | * to turn it into a Repository!!! |
||
80 | * |
||
81 | * Take a look at examples/repositories-async.php on how to limit the amount of |
||
82 | * concurrent requests. |
||
83 | * |
||
84 | * {@inheritdoc} |
||
85 | */ |
||
86 | public function repositories(callable $filter = null): ObservableInterface |
||
102 | |||
103 | /** |
||
104 | * {@inheritdoc} |
||
105 | */ |
||
106 | 1 | public function user(): PromiseInterface |
|
110 | |||
111 | /** |
||
112 | * {@inheritdoc} |
||
113 | */ |
||
114 | 1 | public function sshKey(int $id): PromiseInterface |
|
118 | |||
119 | /** |
||
120 | * @return ObservableInterface |
||
121 | */ |
||
122 | 1 | public function hooks(): ObservableInterface |
|
128 | |||
129 | /** |
||
130 | * {@inheritdoc} |
||
131 | */ |
||
132 | 1 | public function accounts(): ObservableInterface |
|
138 | |||
139 | /** |
||
140 | * {@inheritdoc} |
||
141 | */ |
||
142 | 1 | public function broadcasts(): ObservableInterface |
|
148 | } |
||
149 |
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: