Zephir\Compiler::loadExternalClass PHP Method

loadExternalClass() public method

Loads a class definition in an external dependency
public loadExternalClass ( string $className, string $location ) : boolean
$className string
$location string
return boolean
    public function loadExternalClass($className, $location)
    {
        $filePath = $location . DIRECTORY_SEPARATOR . strtolower(str_replace('\\', DIRECTORY_SEPARATOR, $className)) . '.zep';
        /**
         * Fix the class name
         */
        $className = join('\\', array_map(function ($i) {
            return ucfirst($i);
        }, explode('\\', $className)));
        if (isset($this->files[$className])) {
            return true;
        }
        if (!file_exists($filePath)) {
            return false;
        }
        $this->files[$className] = new CompilerFile($className, $filePath, $this->config, $this->logger);
        $this->files[$className]->setIsExternal(true);
        $this->files[$className]->preCompile($this);
        $this->definitions[$className] = $this->files[$className]->getClassDefinition();
        return true;
    }