NullDiscovery::hasBindingTypes()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
/*
4
 * This file is part of the puli/discovery package.
5
 *
6
 * (c) Bernhard Schussek <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Puli\Discovery;
13
14
use Puli\Discovery\Api\Binding\Binding;
15
use Puli\Discovery\Api\EditableDiscovery;
16
use Puli\Discovery\Api\Type\BindingType;
17
use Puli\Discovery\Api\Type\NoSuchTypeException;
18
use Webmozart\Expression\Expression;
19
20
/**
21
 * A discovery that does nothing.
22
 *
23
 * This discovery can be used if you need to inject a discovery instance in
24
 * some code, but you don't want that discovery to do anything (for example
25
 * in tests).
26
 *
27
 * @since  1.0
28
 *
29
 * @author Bernhard Schussek <[email protected]>
30
 */
31
class NullDiscovery implements EditableDiscovery
32
{
33
    /**
34
     * {@inheritdoc}
35
     */
36 1
    public function findBindings($typeName, Expression $expr = null)
37
    {
38 1
        return array();
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44 1
    public function hasBindings($typeName = null, Expression $expr = null)
45
    {
46 1
        return false;
47
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52 1
    public function getBindings()
53
    {
54 1
        return array();
55
    }
56
57
    /**
58
     * {@inheritdoc}
59
     */
60 1
    public function hasBindingType($typeName)
61
    {
62 1
        return false;
63
    }
64
65
    /**
66
     * {@inheritdoc}
67
     */
68 1
    public function getBindingType($typeName)
69
    {
70 1
        throw NoSuchTypeException::forTypeName($typeName);
71
    }
72
73
    /**
74
     * {@inheritdoc}
75
     */
76 1
    public function hasBindingTypes()
77
    {
78 1
        return false;
79
    }
80
81
    /**
82
     * {@inheritdoc}
83
     */
84 1
    public function getBindingTypes()
85
    {
86 1
        return array();
87
    }
88
89
    /**
90
     * {@inheritdoc}
91
     */
92 3
    public function addBinding(Binding $binding)
93
    {
94 3
    }
95
96
    /**
97
     * {@inheritdoc}
98
     */
99
    public function removeBindings($typeName = null, Expression $expr = null)
100
    {
101
    }
102
103
    /**
104
     * {@inheritdoc}
105
     */
106 4
    public function addBindingType(BindingType $type)
107
    {
108 4
    }
109
110
    /**
111
     * {@inheritdoc}
112
     */
113
    public function removeBindingType($typeName)
114
    {
115
    }
116
117
    /**
118
     * {@inheritdoc}
119
     */
120
    public function removeBindingTypes()
121
    {
122
    }
123
}
124