GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 5e68ac...cec8b8 )
by Cees-Jan
10s
created

Client::stream()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 7
nc 2
nop 0
1
<?php declare(strict_types=1);
2
3
namespace ApiClients\Client\Twitter;
4
5
use ApiClients\Client\Twitter\Resource\TweetInterface;
6
use ApiClients\Client\Twitter\Resource\UserInterface;
7
use React\EventLoop\Factory as LoopFactory;
8
use function Clue\React\Block\await;
9
use React\EventLoop\LoopInterface;
10
11
final class Client implements ClientInterface
12
{
13
    /**
14
     * @var LoopInterface
15
     */
16
    protected $loop;
17
18
    /**
19
     * @var AsyncClient
20
     */
21
    protected $client;
22
23
    /**
24
     * @var StreamingClient
25
     */
26
    protected $streamingClient;
27
28
    public function __construct(
29
        string $consumerKey,
30
        string $consumerSecret
31
    ) {
32
        $this->loop = LoopFactory::create();
33
        $this->client = new AsyncClient($consumerKey, $consumerSecret, $this->loop);
34
    }
35
36
    public function withAccessToken(string $accessToken, string $accessTokenSecret): Client
37
    {
38
        $clone = clone $this;
39
        $clone->client = $this->client->withAccessToken($accessToken, $accessTokenSecret);
40
        return $clone;
41
    }
42
43
    public function withOutAccessToken(): Client
44
    {
45
        $clone = clone $this;
46
        $clone->client = $this->client->withOutAccessToken();
47
        return $clone;
48
    }
49
50
    public function stream(): StreamingClient
51
    {
52
        if (!($this->streamingClient instanceof StreamingClient)) {
53
            $this->streamingClient = new StreamingClient(
54
                $this->loop,
55
                $this->client->getCommandBus(),
56
                $this->client->stream()
57
            );
58
        }
59
60
        return $this->streamingClient;
61
    }
62
63
    public function tweet(string $tweet): TweetInterface
64
    {
65
        return await(
66
            $this->client->tweet($tweet),
0 ignored issues
show
Bug introduced by
The method tweet() does not seem to exist on object<ApiClients\Client\Twitter\AsyncClient>.

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.

Loading history...
67
            $this->loop
68
        );
69
    }
70
71
    public function user(string $tweet): UserInterface
72
    {
73
        return await(
74
            $this->client->user($tweet),
75
            $this->loop
76
        );
77
    }
78
}
79