Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
42.86% |
6 / 14 |
CRAP | |
60.00% |
15 / 25 |
DefinedTargetClass | |
0.00% |
0 / 1 |
|
42.86% |
6 / 14 |
35.50 | |
60.00% |
15 / 25 |
__construct | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
factory | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
getName | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
isAbstract | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
isFinal | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
getMethods | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
anonymous function | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
getInterfaces | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
__toString | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
getNamespaceName | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
inNamespace | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
getShortName | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
implementsInterface | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
hasInternalAncestor | |
0.00% |
0 / 1 |
4.18 | |
77.78% |
7 / 9 |
<?php | |
namespace Mockery\Generator; | |
class DefinedTargetClass | |
{ | |
private $rfc; | |
public function __construct(\ReflectionClass $rfc) | |
{ | |
$this->rfc = $rfc; | |
} | |
public static function factory($name) | |
{ | |
return new self(new \ReflectionClass($name)); | |
} | |
public function getName() | |
{ | |
return $this->rfc->getName(); | |
} | |
public function isAbstract() | |
{ | |
return $this->rfc->isAbstract(); | |
} | |
public function isFinal() | |
{ | |
return $this->rfc->isFinal(); | |
} | |
public function getMethods() | |
{ | |
return array_map(function ($method) { | |
return new Method($method); | |
}, $this->rfc->getMethods()); | |
} | |
public function getInterfaces() | |
{ | |
$class = __CLASS__; | |
return array_map(function ($interface) use ($class) { | |
return new $class($interface); | |
}, $this->rfc->getInterfaces()); | |
} | |
public function __toString() | |
{ | |
return $this->getName(); | |
} | |
public function getNamespaceName() | |
{ | |
return $this->rfc->getNamespaceName(); | |
} | |
public function inNamespace() | |
{ | |
return $this->rfc->inNamespace(); | |
} | |
public function getShortName() | |
{ | |
return $this->rfc->getShortName(); | |
} | |
public function implementsInterface($interface) | |
{ | |
return $this->rfc->implementsInterface($interface); | |
} | |
public function hasInternalAncestor() | |
{ | |
if ($this->rfc->isInternal()) { | |
return true; | |
} | |
$child = $this->rfc; | |
while ($parent = $child->getParentClass()) { | |
if ($parent->isInternal()) { | |
return true; | |
} | |
$child = $parent; | |
} | |
return false; | |
} | |
} |