Issues (9)

src/ServiceProvider/GitlabServiceProvider.php (2 issues)

Labels
Severity
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)
0 ignored issues
show
The method share() does not exist on League\Container\Container. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

36
        $container->/** @scrutinizer ignore-call */ 
37
                    share(LoggerPlugin::class)

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...
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,
0 ignored issues
show
The constant Gitlab\Client::AUTH_URL_TOKEN was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
60
            ]);
61
    }
62
}
63