Completed
Pull Request — master (#175)
by Greg
02:05
created

StdinAwareTrait   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 23
c 0
b 0
f 0
wmc 3
lcom 1
cbo 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setStdinHandler() 0 4 1
A stdin() 0 7 2
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