85% of 126OPs |
93% of 30Lines |
84% of 19Branches |
71% of 17Paths |
| Method | OPs | OPs % | Lines | Line % | Branches | Branches % | Paths | Path % |
|---|---|---|---|---|---|---|---|---|
| mageekguy\atoum\mock\php\method\argument::__construct() | 7 | 100% | 2 | 100% | 1 | 0% | 1 | 100% |
| mageekguy\atoum\mock\php\method\argument::__toString() | 46 | 100% | 14 | 100% | 10 | 100% | 8 | 63% |
| mageekguy\atoum\mock\php\method\argument::getName() | 6 | 100% | 1 | 100% | 1 | 100% | 1 | 100% |
| mageekguy\atoum\mock\php\method\argument::getVariable() | 7 | 0% | 1 | 0% | 1 | 0% | 1 | 0% |
| mageekguy\atoum\mock\php\method\argument::isObject() | 9 | 100% | 2 | 100% | 1 | 100% | 1 | 100% |
| mageekguy\atoum\mock\php\method\argument::isArray() | 8 | 100% | 2 | 100% | 1 | 100% | 1 | 100% |
| mageekguy\atoum\mock\php\method\argument::isUntyped() | 9 | 100% | 2 | 100% | 1 | 100% | 1 | 100% |
| mageekguy\atoum\mock\php\method\argument::isReference() | 9 | 100% | 2 | 100% | 1 | 100% | 1 | 100% |
| mageekguy\atoum\mock\php\method\argument::setDefaultValue() | 13 | 100% | 3 | 100% | 1 | 100% | 1 | 100% |
| mageekguy\atoum\mock\php\method\argument::get() | 12 | 0% | 1 | 0% | 1 | 0% | 1 | 0% |
| # | |
|---|---|
| 1 |
<?php |
| 2 | |
| 3 |
namespace mageekguy\atoum\mock\php\method; |
| 4 | |
| 5 |
use |
| 6 |
mageekguy\atoum |
| 7 |
; |
| 8 | |
| 9 |
class argument |
| 10 |
{
|
| 11 |
protected $type = null; |
| 12 |
protected $isReference = false; |
| 13 |
protected $name = ''; |
| 14 |
protected $defaultValue = null; |
| 15 |
protected $defaultValueIsSet = false; |
| 16 | |
| 17 |
public function __construct($name)100% |
| 18 |
{
|
| 19 |
$this->name = $name; |
| 20 |
} |
| 21 | |
| 22 |
public function __toString()100% |
| 23 |
{
|
| 24 |
$string = '$' . $this->name; |
| 25 | |
| 26 |
if ($this->isReference === true) |
| 27 |
{
|
| 28 |
$string = '& ' . $string; |
| 29 |
} |
| 30 | |
| 31 |
if ($this->type !== null) |
| 32 |
{
|
| 33 |
$string = $this->type . ' ' . $string; |
| 34 |
} |
| 35 | |
| 36 |
if ($this->defaultValueIsSet === true) |
| 37 |
{
|
| 38 |
$string .= '=' . var_export($this->defaultValue, true); |
| 39 |
} |
| 40 | |
| 41 |
return $string; |
| 42 |
} |
| 43 | |
| 44 |
public function getName()100% |
| 45 |
{
|
| 46 |
return $this->name; |
| 47 |
} |
| 48 | |
| 49 |
public function getVariable()0% |
| 50 |
{
|
| 51 |
return '$' . $this->name; |
| 52 |
} |
| 53 | |
| 54 |
public function isObject($type)100% |
| 55 |
{
|
| 56 |
$this->type = $type; |
| 57 | |
| 58 |
return $this; |
| 59 |
} |
| 60 | |
| 61 |
public function isArray()100% |
| 62 |
{
|
| 63 |
$this->type = 'array'; |
| 64 | |
| 65 |
return $this; |
| 66 |
} |
| 67 | |
| 68 |
public function isUntyped()100% |
| 69 |
{
|
| 70 |
$this->type = null; |
| 71 | |
| 72 |
return $this; |
| 73 |
} |
| 74 | |
| 75 |
public function isReference()100% |
| 76 |
{
|
| 77 |
$this->isReference = true; |
| 78 | |
| 79 |
return $this; |
| 80 |
} |
| 81 | |
| 82 |
public function setDefaultValue($defaultValue)100% |
| 83 |
{
|
| 84 |
$this->defaultValue = $defaultValue; |
| 85 |
$this->defaultValueIsSet = true; |
| 86 | |
| 87 |
return $this; |
| 88 |
} |
| 89 | |
| 90 |
public static function get($name)0% |
| 91 |
{
|
| 92 |
return new static($name); |
| 93 |
} |
| 94 |
} |