100% of 95OPs |
100% of 19Lines |
83% of 18Branches |
70% of 10Paths |
| Method | OPs | OPs % | Lines | Line % | Branches | Branches % | Paths | Path % |
|---|---|---|---|---|---|---|---|---|
| mageekguy\atoum\cli::__construct() | 14 | 100% | 2 | 100% | 1 | 0% | 1 | 100% |
| mageekguy\atoum\cli::isTerminal() | 73 | 100% | 15 | 100% | 16 | 94% | 8 | 63% |
| mageekguy\atoum\cli::forceTerminal() | 8 | 100% | 2 | 100% | 1 | 0% | 1 | 100% |
| # | |
|---|---|
| 1 |
<?php |
| 2 |
|
| 3 |
namespace mageekguy\atoum; |
| 4 |
|
| 5 |
use |
| 6 |
mageekguy\atoum |
| 7 |
; |
| 8 |
|
| 9 |
class cli |
| 10 |
{
|
| 11 |
protected $adapter = null; |
| 12 |
|
| 13 |
private static $isTerminal = null; |
| 14 |
|
| 15 |
public function __construct(atoum\adapter $adapter = null)100% |
| 16 |
{
|
| 17 |
$this->adapter = $adapter ?: new atoum\adapter(); |
| 18 |
} |
| 19 |
|
| 20 |
public function isTerminal()100% |
| 21 |
{
|
| 22 |
$isTerminal = self::$isTerminal; |
| 23 |
|
| 24 |
if ($isTerminal === null) |
| 25 |
{
|
| 26 |
$isTerminal = $this->adapter->defined('STDOUT');
|
| 27 |
|
| 28 |
if ($isTerminal === true) |
| 29 |
{
|
| 30 |
$stdoutStat = $this->adapter->fstat($this->adapter->constant('STDOUT'));
|
| 31 |
|
| 32 |
$isTerminal = (($stdoutStat['mode'] & 0170000) === 0020000); // See <sys/stat.h> for more information. |
| 33 |
|
| 34 |
if ($isTerminal === true && $this->adapter->defined('PHP_WINDOWS_VERSION_BUILD') === true)
|
| 35 |
{
|
| 36 |
$isTerminal = ($isTerminal && $this->adapter->getenv('ANSICON') == true);
|
| 37 |
} |
| 38 |
} |
| 39 |
} |
| 40 |
|
| 41 |
return $isTerminal; |
| 42 |
} |
| 43 |
|
| 44 |
public static function forceTerminal()100% |
| 45 |
{
|
| 46 |
self::$isTerminal = true; |
| 47 |
} |
| 48 |
} |