Passed
Push — master ( de3d61...be839c )
by Alec
13:42 queued 13s
created

CustomCharPattern::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
c 0
b 0
f 0
nc 1
nop 3
dl 0
loc 9
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
6
namespace AlecRabbit\Spinner\Extras\Pattern;
7
8
use AlecRabbit\Spinner\Core\Pattern\A\ACharPattern;
9
use Traversable;
10
11
/** @psalm-suppress UnusedClass */
12
final class CustomCharPattern extends ACharPattern
13
{
14
    protected const INTERVAL = 1000;
15
16
    public function __construct(
17
        protected iterable $pattern,
18
        ?int $interval = null,
19
        bool $reversed = false
20
    ) {
21
        parent::__construct(
22
            $this->entries(),
23
            $interval ?? self::INTERVAL,
24
            $reversed
25
        );
26
    }
27
28
    protected function entries(): Traversable
29
    {
30
        yield from $this->pattern;
31
    }
32
}
33