Phalcon\Build\Generator_File_PhalconC::extractReferencedHeaders PHP Method

extractReferencedHeaders() protected method

Scan files' content and extract referenced header files
protected extractReferencedHeaders ( $files ) : array
return array
    protected function extractReferencedHeaders($files)
    {
        $result = array();
        $headers = array();
        $sourceDirLen = strlen($this->sourceDir);
        foreach ($files as $file) {
            foreach (file($file) as $line) {
                if (!preg_match('/^#include "(.+)"/', $line, $matches)) {
                    continue;
                }
                $headerFile = $matches[1];
                if (strpos($headerFile, 'kernel/') !== false) {
                    continue;
                }
                if (strpos($headerFile, 'Zend/') !== false) {
                    $headers[$headerFile] = true;
                    continue;
                }
                if (strpos($headerFile, 'main/') !== false) {
                    $headers[$headerFile] = true;
                    continue;
                }
                if (strpos($headerFile, 'ext/') !== false) {
                    $headers[$headerFile] = true;
                    continue;
                }
                if (strpos($headerFile, 'php_') !== false) {
                    $headers[$headerFile] = true;
                    continue;
                }
                if (strpos($headerFile, 'spl_') !== false) {
                    $headers[$headerFile] = true;
                    continue;
                }
                $possiblePathFromCurrent = Util::normalize('ext/' . $headerFile);
                if ($possiblePathFromCurrent == "") {
                    continue;
                }
                if (isset($this->skipFiles[$possiblePathFromCurrent])) {
                    continue;
                }
                $fullPath = $possiblePathFromCurrent;
                $result[$fullPath] = true;
            }
        }
        return array_keys($result);
    }