StreamOutput::write()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
/*
3
 * PHP SAPI Library
4
 * Copyright (C) 2020 Christian Neff
5
 *
6
 * Permission to use, copy, modify, and/or distribute this software for
7
 * any purpose with or without fee is hereby granted, provided that the
8
 * above copyright notice and this permission notice appear in all copies.
9
 */
10
11
namespace Secondtruth\SAPI\Output;
12
13
use Secondtruth\SAPI\OutputInterface;
14
use Secondtruth\SAPI\Stream\AbstractStream;
15
16
/**
17
 * The StreamOutput class.
18
 *
19
 * @author Christian Neff <[email protected]>
20
 */
21
class StreamOutput extends AbstractStream implements OutputInterface
22
{
23
    /**
24
     * {@inheritdoc}
25
     */
26
    public function write($data)
27
    {
28
        fwrite($this->stream, $data);
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    protected function openStream(string $stream)
35
    {
36
        return fopen($stream, 'w');
37
    }
38
}
39