Completed
Push — master ( d4a5ef...80da94 )
by Gjero
03:37
created

Std::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 2
c 1
b 0
f 1
nc 1
nop 1
dl 0
loc 4
rs 10
1
<?php
2
/**
3
 * Pimf
4
 *
5
 * @copyright Copyright (c)  Gjero Krsteski (http://krsteski.de)
6
 * @license   http://opensource.org/licenses/MIT MIT License
7
 */
8
9
namespace Pimf\Adapter;
10
11
use Pimf\Contracts\Streamable;
12
13
/**
14
 * Class Std will treat event streams unbuffered.
15
 *
16
 * @package Pimf\Adapter
17
 */
18
class Std implements Streamable
19
{
20
    /**
21
     * Opens stream to stdout
22
     */
23
    const OUT = "php://stdout";
24
25
    /**
26
     * Opens stream to stderr
27
     */
28
    const ERR = "php://stderr";
29
30
    /**
31
     * Type of stream
32
     * @var string
33
     */
34
    protected $type;
35
36
    /**
37
     * Std constructor.
38
     * @param string $type
39
     */
40
    public function __construct($type = self::OUT)
41
    {
42
        $this->type = $type;
43
    }
44
45
    /** @inheritdoc */
46
    public function open()
47
    {
48
        return fopen($this->type, "w");
49
    }
50
}
51