Registry::fetch()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
/**
4
 * This file is part of Railt package.
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
declare(strict_types=1);
11
12
namespace Railt\SDL\Backend\Linker;
13
14
use GraphQL\Contracts\TypeSystem\SchemaInterface;
15
16
/**
17
 * Class Registry
18
 */
19
final class Registry implements LinkerInterface
20
{
21
    /**
22
     * @var array|callable[]
23
     */
24
    private array $loaders = [];
25
26
    /**
27
     * @param string $type
28
     * @param SchemaInterface $context
29
     * @return void
30
     * @throws \LogicException
31
     */
32
    public function fetch(string $type, SchemaInterface $context)
0 ignored issues
show
Unused Code introduced by
The parameter $type is not used and could be removed. ( Ignorable by Annotation )

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

32
    public function fetch(/** @scrutinizer ignore-unused */ string $type, SchemaInterface $context)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $context is not used and could be removed. ( Ignorable by Annotation )

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

32
    public function fetch(string $type, /** @scrutinizer ignore-unused */ SchemaInterface $context)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
33
    {
34
        throw new \LogicException('Not implemented yet');
35
    }
36
37
    /**
38
     * {@inheritDoc}
39
     */
40
    public function getAutoloaders(): iterable
41
    {
42
        return $this->loaders;
43
    }
44
45
    /**
46
     * @param callable $loader
47
     * @return $this
48
     */
49
    public function autoload(callable $loader): self
50
    {
51
        $this->loaders[] = $loader;
52
53
        return $this;
54
    }
55
56
    /**
57
     * @param callable $loader
58
     * @return $this
59
     */
60
    public function cancelAutoload(callable $loader): self
61
    {
62
        $this->loaders = \array_filter($this->loaders, static function (callable $haystack) use ($loader): bool {
63
            return $haystack !== $loader;
64
        });
65
66
        return $this;
67
    }
68
}
69