Passed
Pull Request — master (#1104)
by Maxim
12:14
created

PaginationBootloader   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 10
dl 0
loc 26
ccs 15
cts 15
cp 1
rs 10
c 1
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A defineDependencies() 0 4 1
A defineSingletons() 0 12 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Spiral\Bootloader\Http;
6
7
use Spiral\Boot\Bootloader\Bootloader;
8
use Spiral\Core\BinderInterface;
9
use Spiral\Core\Config\DeprecationProxy;
10
use Spiral\Framework\Spiral;
11
use Spiral\Http\PaginationFactory;
12
use Spiral\Pagination\PaginationProviderInterface;
13
14
final class PaginationBootloader extends Bootloader
15
{
16 355
    public function __construct(
17
        private readonly BinderInterface $binder,
18
    ) {
19 355
    }
20
21 355
    public function defineDependencies(): array
22
    {
23 355
        return [
24 355
            HttpBootloader::class,
25 355
        ];
26
    }
27
28 355
    public function defineSingletons(): array
29
    {
30 355
        $httpRequest = $this->binder->getBinder(Spiral::HttpRequest);
0 ignored issues
show
Bug introduced by
The method getBinder() does not exist on Spiral\Core\BinderInterface. It seems like you code against a sub-type of Spiral\Core\BinderInterface such as Spiral\Core\Container. ( Ignorable by Annotation )

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

30
        /** @scrutinizer ignore-call */ 
31
        $httpRequest = $this->binder->getBinder(Spiral::HttpRequest);
Loading history...
31 355
        $httpRequest->bindSingleton(PaginationFactory::class, PaginationFactory::class);
32 355
        $httpRequest->bindSingleton(PaginationProviderInterface::class, PaginationFactory::class);
33
34 355
        $this->binder->bind(
35 355
            PaginationProviderInterface::class,
36 355
            new DeprecationProxy(PaginationProviderInterface::class, true, Spiral::HttpRequest, '4.0')
0 ignored issues
show
Bug introduced by
Spiral\Framework\Spiral::HttpRequest of type Spiral\Framework\Spiral is incompatible with the type BackedEnum|null|string expected by parameter $scope of Spiral\Core\Config\DeprecationProxy::__construct(). ( Ignorable by Annotation )

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

36
            new DeprecationProxy(PaginationProviderInterface::class, true, /** @scrutinizer ignore-type */ Spiral::HttpRequest, '4.0')
Loading history...
37 355
        );
38
39 355
        return [];
40
    }
41
}
42