Passed
Pull Request — master (#116)
by Max
03:13
created

ContextVeil::__call()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 2
dl 0
loc 3
rs 10
1
<?php
2
3
namespace MaxGoryunov\SavingIterator\Src;
4
5
/**
6
 * Veil which applies context to origin if the condition is met.
7
 * @template T of object origin type.
8
 * @implements Indifferent<T>
9
 * @mixin T
10
 */
11
final class ContextVeil implements Indifferent
12
{
13
14
    /**
15
     * Ctor.
16
     * 
17
     * @phpstan-param T $origin
18
     * @param object $origin original element.
19
     */
20
    public function __construct(
21
        /**
22
         * Original element.
23
         *
24
         * @phpstan-var T
25
         * @var object
26
         */
27
        private object $origin
28
    ) {
29
    }
30
31
    /**
32
     * {@inheritDoc}
33
     */
34
    public function __call(string $name, array $arguments): mixed
35
    {
36
        return $this->origin->$name(...$arguments);
37
    }
38
}
39