Completed
Push — master ( 9988ed...5c7b62 )
by Greg
01:53
created

StdinAwareTrait::setStdinHandler()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Consolidation\AnnotatedCommand\Input;
4
5
/**
6
 * StdinAwareTrait provides the implementation for StdinAwareInterface.
7
 */
8
trait StdinAwareTrait
9
{
10
    protected $stdinHandler;
11
12
    /**
13
     * @inheritdoc
14
     */
15
    public function setStdinHandler(StdinHandler $stdin)
16
    {
17
        $this->stdinHandler = $stdin;
18
    }
19
20
    /**
21
     * @inheritdoc
22
     */
23
    public function stdin()
24
    {
25
        if (!$this->stdinHandler) {
26
            $this->stdinHandler = new StdinHandler();
27
        }
28
        return $this->stdinHandler;
29
    }
30
}
31