Passed
Push — feature/94 ( c3385c )
by Max
11:34
created

ContextVeil   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 2
c 1
b 0
f 1
dl 0
loc 24
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A __call() 0 3 1
1
<?php
2
3
namespace MaxGoryunov\SavingIterator\Src;
4
5
/**
6
 * Veil which applies context to origin if the condition is met.
7
 */
8
final class ContextVeil implements Indifferent
9
{
10
11
    /**
12
     * Ctor.
13
     * 
14
     * @param mixed $origin original element.
15
     */
16
    public function __construct(
17
        /**
18
         * Original element.
19
         *
20
         * @var mixed
21
         */
22
        private mixed $origin
23
    ) {
24
    }
25
26
    /**
27
     * {@inheritDoc}
28
     */
29
    public function __call(string $name, array $arguments): mixed
30
    {
31
        return $this->origin->$name(...$arguments);
32
    }
33
}
34