ResourceClientModule::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 26
Code Lines 23

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 23
nc 1
nop 0
dl 0
loc 26
rs 9.552
c 2
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace BEAR\Resource\Module;
6
7
use BEAR\Resource\Anchor;
8
use BEAR\Resource\AnchorInterface;
9
use BEAR\Resource\DataLoader\DataLoader;
10
use BEAR\Resource\ExtraMethodInvoker;
0 ignored issues
show
Bug introduced by
The type BEAR\Resource\ExtraMethodInvoker was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use BEAR\Resource\Factory;
12
use BEAR\Resource\FactoryInterface;
13
use BEAR\Resource\HalLink;
14
use BEAR\Resource\HalLinker;
15
use BEAR\Resource\Invoker;
16
use BEAR\Resource\InvokerInterface;
17
use BEAR\Resource\LinkCrawler;
18
use BEAR\Resource\LinkCrawlerInterface;
19
use BEAR\Resource\Linker;
20
use BEAR\Resource\LinkerInterface;
21
use BEAR\Resource\LoggerInterface;
22
use BEAR\Resource\NamedParameter;
23
use BEAR\Resource\NamedParameterInterface;
24
use BEAR\Resource\NamedParamMetas;
25
use BEAR\Resource\NamedParamMetasInterface;
26
use BEAR\Resource\NullLogger;
27
use BEAR\Resource\NullReverseLink;
28
use BEAR\Resource\NullReverseLinker;
29
use BEAR\Resource\OptionsMethods;
0 ignored issues
show
Bug introduced by
The type BEAR\Resource\OptionsMethods was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
30
use BEAR\Resource\OptionsRenderer;
0 ignored issues
show
Bug introduced by
The type BEAR\Resource\OptionsRenderer was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
31
use BEAR\Resource\PhpClassInvoker;
0 ignored issues
show
Bug introduced by
The type BEAR\Resource\PhpClassInvoker was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
32
use BEAR\Resource\PrettyJsonRenderer;
33
use BEAR\Resource\RenderInterface;
34
use BEAR\Resource\ResourceInterface;
35
use BEAR\Resource\ResourcePure;
36
use BEAR\Resource\ReverseLinkerInterface;
37
use BEAR\Resource\ReverseLinkInterface;
38
use BEAR\Resource\SchemeCollectionInterface;
39
use BEAR\Resource\UriFactory;
0 ignored issues
show
Bug introduced by
The type BEAR\Resource\UriFactory was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
40
use Override;
41
use Ray\Di\AbstractModule;
42
use Ray\Di\Exception\NotFound;
43
use Ray\Di\Scope;
44
use Ray\InputQuery\FileUploadFactory;
45
use Ray\InputQuery\FileUploadFactoryInterface;
46
use Ray\InputQuery\InputQuery;
47
use Ray\InputQuery\InputQueryInterface;
48
49
/**
50
 * Provides ResourceInterface and derived bindings
51
 *
52
 * The following module is installed:
53
 *
54
 * UriFactory
55
 * ResourceInterface
56
 * InvokerInterface
57
 * LinkerInterface
58
 * FactoryInterface
59
 * SchemeCollectionInterface
60
 * AnchorInterface
61
 * NamedParameterInterface
62
 * RenderInterface
63
 * RenderInterface-options
64
 * OptionsMethods
65
 * NamedParamMetasInterface
66
 * ExtraMethodInvoker
67
 * HalLink
68
 * ReverseLinkInterface
69
 * LoggerInterface
70
 * HalLinker
71
 * ReverseLinkerInterface
72
 */
73
final class ResourceClientModule extends AbstractModule
74
{
75
    /**
76
     * {@inheritDoc}
77
     *
78
     * @throws NotFound
79
     */
80
    #[Override]
81
    protected function configure(): void
82
    {
83
        $this->bind(UriFactory::class);
84
        $this->bind(ResourceInterface::class)->to(ResourcePure::class)->in(Scope::SINGLETON);
85
        $this->bind(InvokerInterface::class)->to(Invoker::class);
86
        $this->bind(LinkCrawlerInterface::class)->to(LinkCrawler::class);
87
        $this->bind(LinkerInterface::class)->to(Linker::class);
88
        $this->bind(FactoryInterface::class)->to(Factory::class);
89
        $this->bind(SchemeCollectionInterface::class)->toProvider(SchemeCollectionProvider::class);
0 ignored issues
show
Bug introduced by
The type BEAR\Resource\Module\SchemeCollectionProvider was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
90
        $this->bind(AnchorInterface::class)->to(Anchor::class);
91
        $this->bind(NamedParameterInterface::class)->to(NamedParameter::class);
92
        $this->bind(RenderInterface::class)->to(PrettyJsonRenderer::class)->in(Scope::SINGLETON);
93
        /** @psalm-suppress DeprecatedClass */
94
        $this->bind(RenderInterface::class)->annotatedWith('options')->to(OptionsRenderer::class);
95
        $this->bind(OptionsMethods::class);
96
        $this->bind(NamedParamMetasInterface::class)->to(NamedParamMetas::class);
97
        $this->bind(ExtraMethodInvoker::class);
98
        $this->bind(HalLinker::class);
99
        $this->bind(ReverseLinkerInterface::class)->to(NullReverseLinker::class);
100
        $this->bind(LoggerInterface::class)->to(NullLogger::class);
101
        $this->configureDeprecatedBindings();
102
        $this->bind(PhpClassInvoker::class);
103
        $this->bind(InputQueryInterface::class)->to(InputQuery::class);
104
        $this->bind(FileUploadFactoryInterface::class)->to(FileUploadFactory::class);
105
        $this->bind(DataLoader::class);
106
    }
107
108
    /** @psalm-suppress DeprecatedClass */
109
    private function configureDeprecatedBindings(): void
110
    {
111
        $this->bind(HalLink::class);
112
        $this->bind(ReverseLinkInterface::class)->to(NullReverseLink::class);
113
    }
114
}
115