1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
|
3
|
|
|
namespace ApiClients\Client\Github\Resource\Async; |
4
|
|
|
|
5
|
|
|
use ApiClients\Foundation\Hydrator\CommandBus\Command\HydrateCommand; |
6
|
|
|
use ApiClients\Foundation\Transport\CommandBus\Command\JsonEncodeCommand; |
7
|
|
|
use ApiClients\Foundation\Transport\CommandBus\Command\RequestCommand; |
8
|
|
|
use ApiClients\Foundation\Transport\Response; |
9
|
|
|
use ApiClients\Client\Github\CommandBus\Command\IteratePagesCommand; |
10
|
|
|
use ApiClients\Client\Github\Resource\Repository as BaseRepository; |
11
|
|
|
use GuzzleHttp\Psr7\Request; |
12
|
|
|
use React\Promise\PromiseInterface; |
13
|
|
|
use Rx\Observable; |
14
|
|
|
use Rx\ObservableInterface; |
15
|
|
|
|
16
|
|
|
class Repository extends BaseRepository |
17
|
|
|
{ |
18
|
|
|
public function refresh() : Repository |
19
|
|
|
{ |
20
|
|
|
return $this->wait($this->callAsync('refresh')); |
|
|
|
|
21
|
|
|
} |
22
|
|
|
|
23
|
|
|
public function labels(): ObservableInterface |
24
|
|
|
{ |
25
|
|
|
return $this->getCommandBus()->handle( |
|
|
|
|
26
|
|
|
new IteratePagesCommand('repos/' . $this->fullName() . '/labels') |
27
|
|
|
)->flatMap(function ($response) { |
28
|
|
|
return Observable::fromArray($response); |
29
|
|
|
})->map(function ($label) { |
30
|
|
|
return $this->getCommandBus()->handle(new HydrateCommand('Label', $label)); |
|
|
|
|
31
|
|
|
}); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
public function addLabel(string $name, string $colour): PromiseInterface |
|
|
|
|
35
|
|
|
{ |
36
|
|
|
return $this->getCommandBus()->handle( |
|
|
|
|
37
|
|
|
new JsonEncodeCommand([]) |
38
|
|
|
)->then(function (string $json) { |
39
|
|
|
return $this->getCommandBus()->handle( |
|
|
|
|
40
|
|
|
new RequestCommand( |
41
|
|
|
new Request( |
42
|
|
|
'POST', |
43
|
|
|
'repos/' . $this->fullName() . '/labels', |
44
|
|
|
[], |
45
|
|
|
$json |
46
|
|
|
) |
47
|
|
|
) |
48
|
|
|
); |
49
|
|
|
})->then(function (Response $response) { |
50
|
|
|
var_export($response->getBody()); |
51
|
|
|
}); |
52
|
|
|
} |
53
|
|
|
} |
54
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.