function ClassMirror::reflectClassToNode
Parameters
ReflectionClass<object> $class:
1 call to ClassMirror::reflectClassToNode()
- ClassMirror::reflect in vendor/
phpspec/ prophecy/ src/ Prophecy/ Doubler/ Generator/ ClassMirror.php - Reflects provided arguments into class node.
File
-
vendor/
phpspec/ prophecy/ src/ Prophecy/ Doubler/ Generator/ ClassMirror.php, line 96
Class
- ClassMirror
- Class mirror. Core doubler class. Mirrors specific class and/or interfaces into class node tree.
Namespace
Prophecy\Doubler\GeneratorCode
private function reflectClassToNode(ReflectionClass $class, Node\ClassNode $node) : void {
if (true === $class->isFinal()) {
throw new ClassMirrorException(sprintf('Could not reflect class %s as it is marked final.', $class->getName()), $class);
}
if (method_exists(ReflectionClass::class, 'isReadOnly')) {
$node->setReadOnly($class->isReadOnly());
}
$node->setParentClass($class->getName());
foreach ($class->getMethods(ReflectionMethod::IS_ABSTRACT) as $method) {
if (false === $method->isProtected()) {
continue;
}
$this->reflectMethodToNode($method, $node);
}
foreach ($class->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {
if (0 === strpos($method->getName(), '_') && !in_array($method->getName(), self::REFLECTABLE_METHODS)) {
continue;
}
if (true === $method->isFinal()) {
$node->addUnextendableMethod($method->getName());
continue;
}
$this->reflectMethodToNode($method, $node);
}
}