Test Setup Failed
Push — master ( 016bc5...505cdc )
by Alec
02:25
created

EchoOutputAdapter::getStream()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php declare(strict_types=1);
2
3
namespace AlecRabbit\Spinner\Core\Adapters;
4
5
use AlecRabbit\Spinner\Core\Contracts\OutputInterface;
6
7
/**
8
 * Class EchoOutputAdapter
9
 *
10
 * @codeCoverageIgnore
11
 */
12
class EchoOutputAdapter implements OutputInterface
13
{
14
    /** {@inheritDoc} */
15
    public function write($messages, $newline = false, $options = 0): void
16
    {
17
        if (!is_iterable($messages)) {
18
            $messages = [$messages];
19
        }
20
        $nl = $newline ? PHP_EOL : '';
21
        foreach ($messages as $message) {
22
            echo $message . $nl;
23
        }
24
    }
25
26
    /**
27
     * @return resource
28
     */
29
    public function getStream()
30
    {
31
        return STDOUT;
32
    }
33
}
34