Passed
Push — master ( 14e7f5...3d22f9 )
by Alec
03:44 queued 01:59
created

EchoOutputAdapter::write()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 20

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 7
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0
cc 4
nc 4
nop 3
crap 20
1
<?php declare(strict_types=1);
2
3
namespace AlecRabbit\Spinner\Core\Adapters;
4
5
use AlecRabbit\Spinner\Core\Contracts\SpinnerOutputInterface;
6
7
/**
8
 * Class EchoOutputAdapter
9
 */
10
class EchoOutputAdapter implements SpinnerOutputInterface
11
{
12
    /** {@inheritDoc} */
13
    public function write($messages, $newline = false, $options = 0): void
14
    {
15
        if (!is_iterable($messages)) {
16
            $messages = [$messages];
17
        }
18
        foreach ($messages as $message) {
19
            echo $message . ($newline ? PHP_EOL : '');
20
        }
21
    }
22
}