Completed
Push — master ( 1a9936...b9df3b )
by Marco
23:13
created

setMethodPrefixInterceptor()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 1
nc 1
nop 2
1
<?php
2
/*
3
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
5
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
6
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
12
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
13
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14
 *
15
 * This software consists of voluntary contributions made by many individuals
16
 * and is licensed under the MIT license.
17
 */
18
19
declare(strict_types=1);
20
21
namespace ProxyManagerTestAsset;
22
23
use ProxyManager\Proxy\AccessInterceptorValueHolderInterface;
24
25
/**
26
 * Base test class to catch instantiations of access interceptor value holders
27
 *
28
 * @author Marco Pivetta <[email protected]>
29
 * @license MIT
30
 */
31
class AccessInterceptorValueHolderMock implements AccessInterceptorValueHolderInterface
32
{
33
    /**
34
     * @var object
35
     */
36
    public $instance;
37
38
    /**
39
     * @var callable[]
40
     */
41
    public $prefixInterceptors;
42
43
    /**
44
     * @var callable[]
45
     */
46
    public $suffixInterceptors;
47
48
    /**
49
     * @param object     $instance
50
     * @param callable[] $prefixInterceptors
51
     * @param callable[] $suffixInterceptors
52
     *
53
     * @return self
54
     */
55
    public static function staticProxyConstructor($instance, $prefixInterceptors, $suffixInterceptors) : self
56
    {
57
        $selfInstance = new static(); // note: static because on-the-fly generated classes in tests extend this one.
58
59
        $selfInstance->instance           = $instance;
60
        $selfInstance->prefixInterceptors = $prefixInterceptors;
61
        $selfInstance->suffixInterceptors = $suffixInterceptors;
62
63
        return $selfInstance;
64
    }
65
66
    /**
67
     * {@inheritDoc}
68
     */
69
    public function setMethodPrefixInterceptor(string $methodName, \Closure $prefixInterceptor = null)
70
    {
71
        // no-op (on purpose)
72
    }
73
74
    /**
75
     * {@inheritDoc}
76
     */
77
    public function setMethodSuffixInterceptor(string $methodName, \Closure $suffixInterceptor = null)
78
    {
79
        // no-op (on purpose)
80
    }
81
82
    /**
83
     * {@inheritDoc}
84
     */
85
    public function getWrappedValueHolderValue()
86
    {
87
        return $this->instance;
88
    }
89
}
90