100% of 74OPs |
100% of 12Lines |
83% of 6Branches |
100% of 6Paths |
| Method | OPs | OPs % | Lines | Line % | Branches | Branches % | Paths | Path % |
|---|---|---|---|---|---|---|---|---|
| mageekguy\atoum\script\prompt::__construct() | 12 | 100% | 4 | 100% | 1 | 0% | 1 | 100% |
| mageekguy\atoum\script\prompt::getInputReader() | 6 | 100% | 1 | 100% | 1 | 100% | 1 | 100% |
| mageekguy\atoum\script\prompt::setInputReader() | 16 | 100% | 2 | 100% | 1 | 100% | 1 | 100% |
| mageekguy\atoum\script\prompt::getOutputWriter() | 6 | 100% | 1 | 100% | 1 | 100% | 1 | 100% |
| mageekguy\atoum\script\prompt::setOutputWriter() | 16 | 100% | 2 | 100% | 1 | 100% | 1 | 100% |
| mageekguy\atoum\script\prompt::ask() | 18 | 100% | 2 | 100% | 1 | 100% | 1 | 100% |
| # | |
|---|---|
| 1 |
<?php |
| 2 |
|
| 3 |
namespace mageekguy\atoum\script; |
| 4 |
|
| 5 |
use |
| 6 |
mageekguy\atoum\writer, |
| 7 |
mageekguy\atoum\writers, |
| 8 |
mageekguy\atoum\reader, |
| 9 |
mageekguy\atoum\readers\std |
| 10 |
; |
| 11 |
|
| 12 |
class prompt |
| 13 |
{
|
| 14 |
protected $inputReader = null; |
| 15 |
protected $outputWriter = null; |
| 16 |
|
| 17 |
public function __construct()100% |
| 18 |
{
|
| 19 |
$this |
| 20 |
->setInputReader() |
| 21 |
->setOutputWriter() |
| 22 |
; |
| 23 |
} |
| 24 |
|
| 25 |
public function getInputReader()100% |
| 26 |
{
|
| 27 |
return $this->inputReader; |
| 28 |
} |
| 29 |
|
| 30 |
public function setInputReader(reader $inputReader = null)100% |
| 31 |
{
|
| 32 |
$this->inputReader = $inputReader ?: new std\in(); |
| 33 |
|
| 34 |
return $this; |
| 35 |
} |
| 36 |
|
| 37 |
public function getOutputWriter()100% |
| 38 |
{
|
| 39 |
return $this->outputWriter; |
| 40 |
} |
| 41 |
|
| 42 |
public function setOutputWriter(writer $writer = null)100% |
| 43 |
{
|
| 44 |
$this->outputWriter = $writer ?: new writers\std\out(); |
| 45 |
|
| 46 |
return $this; |
| 47 |
} |
| 48 |
|
| 49 |
public function ask($message)100% |
| 50 |
{
|
| 51 |
$this->outputWriter->write($message); |
| 52 |
|
| 53 |
return $this->inputReader->read(); |
| 54 |
} |
| 55 |
} |