Passed
Pull Request — master (#144)
by Max
02:29
created

EmptyReaction   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A edited() 0 7 2
1
<?php
2
3
namespace MaxGoryunov\SavingIterator\Src;
4
5
use BadMethodCallException;
6
7
/**
8
 * Reactions which return the object as it is.
9
 * @template T
10
 * @implements Reaction<T>
11
 */
12
final class EmptyReaction implements Reaction
13
{
14
15
    /**
16
     * {@inheritDoc}
17
     */
18
    public function edited(mixed $subject, string $method): mixed
19
    {
20
21
        return ($method !== "")
22
        ? $subject
23
        : throw new BadMethodCallException(
24
            "Empty method call is not allowed for empty reaction"
25
        );
26
    }
27
}
28