1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
|
3
|
|
|
namespace DanielPieper\MergeReminder\ServiceProvider; |
4
|
|
|
|
5
|
|
|
use Gitlab\Client; |
6
|
|
|
use Gitlab\HttpClient\Builder; |
7
|
|
|
use Http\Client\Common\Plugin\CachePlugin; |
8
|
|
|
use Http\Client\Common\Plugin\LoggerPlugin; |
9
|
|
|
use Http\Client\HttpClient; |
10
|
|
|
use Http\Discovery\StreamFactoryDiscovery; |
11
|
|
|
use League\Container\Container; |
12
|
|
|
use League\Container\ServiceProvider\AbstractServiceProvider; |
13
|
|
|
use Psr\Cache\CacheItemPoolInterface; |
14
|
|
|
use Psr\Log\LoggerInterface; |
15
|
|
|
|
16
|
|
|
class GitlabServiceProvider extends AbstractServiceProvider |
17
|
|
|
{ |
18
|
|
|
/** |
19
|
|
|
* {@inheritdoc} |
20
|
|
|
*/ |
21
|
|
|
protected $provides = [ |
22
|
|
|
LoggerPlugin::class, |
23
|
|
|
CachePlugin::class, |
24
|
|
|
Builder::class, |
25
|
|
|
Client::class, |
26
|
|
|
]; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* {@inheritdoc} |
30
|
|
|
*/ |
31
|
|
|
public function register() |
32
|
|
|
{ |
33
|
|
|
/** @var Container $container */ |
34
|
|
|
$container = $this->getContainer(); |
35
|
|
|
|
36
|
|
|
$container->share(LoggerPlugin::class) |
|
|
|
|
37
|
|
|
->addArgument(LoggerInterface::class); |
38
|
|
|
|
39
|
|
|
$container->share(CachePlugin::class) |
40
|
|
|
->addArguments([ |
41
|
|
|
CacheItemPoolInterface::class, |
42
|
|
|
StreamFactoryDiscovery::find(), |
43
|
|
|
[ |
44
|
|
|
'default_ttl' => 600, |
45
|
|
|
'respect_response_cache_directives' => [], |
46
|
|
|
] |
47
|
|
|
]); |
48
|
|
|
|
49
|
|
|
$container->share(Builder::class) |
50
|
|
|
->addArgument(HttpClient::class) |
51
|
|
|
->addMethodCall('addPlugin', [LoggerPlugin::class]) |
52
|
|
|
->addMethodCall('addPlugin', [CachePlugin::class]); |
53
|
|
|
|
54
|
|
|
$container->share(Client::class) |
55
|
|
|
->addArgument(Builder::class) |
56
|
|
|
->addMethodCall('setUrl', ['GITLAB_URL']) |
57
|
|
|
->addMethodCall('authenticate', [ |
58
|
|
|
'GITLAB_TOKEN', |
59
|
|
|
Client::AUTH_URL_TOKEN, |
|
|
|
|
60
|
|
|
]); |
61
|
|
|
} |
62
|
|
|
} |
63
|
|
|
|
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.