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

EchoOutputAdapter   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
eloc 5
dl 0
loc 10
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A write() 0 7 4
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
}