Phan\Language\Element\Clazz::importAncestorClass PHP Метод

importAncestorClass() публичный Метод

Add properties, constants and methods from the given class to this.
public importAncestorClass ( CodeBase $code_base, Clazz $class, Option | Phan\Library\None $type_option ) : void
$code_base Phan\CodeBase A reference to the code base in which the ancestor exists
$class Clazz A class to import from
$type_option Option | Phan\Library\None
Результат void
    public function importAncestorClass(CodeBase $code_base, Clazz $class, $type_option)
    {
        if (!$this->isFirstExecution(__METHOD__ . ':' . (string) $class->getFQSEN())) {
            return;
        }
        $class->addReference($this->getContext());
        // Make sure that the class imports its parents first
        $class->hydrate($code_base);
        // Copy properties
        foreach ($class->getPropertyMap($code_base) as $property) {
            $this->addProperty($code_base, $property, $type_option);
        }
        // Copy constants
        foreach ($class->getConstantMap($code_base) as $constant) {
            $this->addConstant($code_base, $constant);
        }
        // Copy methods
        foreach ($class->getMethodMap($code_base) as $method) {
            $this->addMethod($code_base, $method, $type_option);
        }
    }