Passed
Push — master ( c154f0...78d376 )
by Max
58s queued 12s
created

EmptyReaction::edited()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
cc 2
eloc 4
c 2
b 0
f 1
nc 2
nop 2
dl 0
loc 6
rs 10
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
        return ($method !== "")
21
        ? $subject
22
        : throw new BadMethodCallException(
23
            "Empty method call is not allowed for empty reaction"
24
        );
25
    }
26
}
27