/*
Includes a file

@param string $include Filename or class name following the PEAR convention
@param bool $className If true, $include will be transformed from a PEAR-formed class name to a filename
@return bool
548141
public static function needed($include, $className = true)
    {
        if ($className && (class_exists($include, false) || interface_exists($include, false))) {
            return true;
        }

        self::fireEvent('Atomik::Needed', array(&$include, &$className, &$dirs));
        if ($include === null) {
            return false;
        }

        $includeDirs = (array) self::get('atomik.dirs.includes', array());
        if ($filename = self::resolveIncludePath($include, $includeDirs, $className)) {
            return include($filename);
        }
        return false;
    }
19102
function includedFiles(name){
    let includes=this.getIncludes(this.getFile(name));
    let ret=includes.map(include => {
        let ret = {
            absolute:path.join(name,"../",include.relPath),
            relative:include.relPath,
            match:include.match
        }
        return ret;
    })
    return ret;
}
994445
public static function autoload($className) {
        if (array_key_exists($className, self::$classes)) {
            $fileName = realpath(dirname(__FILE__)) . '/' . self::$classes[$className];
            if (file_exists($fileName)) {
                include $fileName;
            }
        }
    }
679046
public function isTransient($className)
    {
        $fileName = str_replace('\\', '.', $className) . $this->fileExtension;

        // Check whether file exists
        foreach ((array) $this->paths as $path) {
            if (file_exists($path . DIRECTORY_SEPARATOR . $fileName)) {
                return false;
            }
        }

        return true;
    }
88986
protected function load($filename)
    {
        $success = false;

        if (file_exists($filename)) {
            /** @noinspection PhpIncludeInspection */
            require $filename;
            $success = true;
        }

        return $success;
    }
162025
public function addClassToProcess($className)
    {
        if (!class_exists($className)) {
            return false;
        }

        $this->classesToProcess[(string) $className] = true;
        return true;
    }
218291
public function getInclude($fieldName)
    {
        if ($this->isInclude($fieldName) === false) {
            return false;
        }

        return $this->mapping[$fieldName]['include'];
    }
996352
public function loadClass($className)
    {
        $fileName = "";
        if (false !== ($lastNsPos = strripos($className, self::NAMESPACE_SEPARATOR))) {
            $namespace = substr($className, 0, $lastNsPos);
            $className = substr($className, $lastNsPos + 1);
            $fileName = str_replace(self::NAMESPACE_SEPARATOR, DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
        }
        $fileName .= str_replace("_", DIRECTORY_SEPARATOR, $className) . self::FILE_EXTENSION;

        foreach ($this->paths as $path) {
            $filePath = $path . DIRECTORY_SEPARATOR . $fileName;
            if (file_exists($filePath)) {
                require_once $filePath;
            }
        }
    }
1285143
public void addInclude(String include) {

        include = normalizePath(include);
        m_includes.add(include);
        m_allPaths.add(include);
    }
1234135
private boolean matchesIncludes( final String fileName )
    {
        if( m_includes.length == 0 )
        {
            return true;
        }
        for( Pattern include : m_includes )
        {
            if( include.matcher( fileName ).matches() )
            {
                return true;
            }
        }
        return false;
    }
1007828
public function load($className) {
    // search under baseDir assuming that namespaces match directories
    $filename = $this->baseDir.str_replace("\\", "/", $className).'.php';
    if (file_exists($filename)) {
      include($filename);
    }
  }
428131
def include_file(_parent, indent)
      return unless accept :include

      # Process data
      name = accept :line_feed || ''
      name.strip!

      # Check if there is any string after the include input
      Logger.error :parse, @code, @i, @j, :include_end if name.empty?

      # Get the complete file path based on the current file being compiled
      include_path = File.expand_path name, File.dirname(@file[-1][0])

      # Try to see if it has any existing extension, otherwise add .op
      include_path += Settings::FILE_EXTENSION if File.extname(name).empty?

      # Throw an error if the file doesn't exist
      unless Dir[include_path].any?
        Logger.error :parse, @code, @i, @j, :include, name
      end

      # include entire directory tree
      Dir[include_path].each do |file|
        # Skip current file when including from same directory
        next if file == @file[-1][0]

        @file << [include_path, indent]

        # Throw an error if the file doesn't exist
        if File.directory? file
          Logger.error :parse, @code, @i, @j, :include_dir, file
        end

        # Throw an error if the file doesn't exist
        unless File.file? file
          Logger.error :parse, @code, @i, @j, :include, file
        end

        # Indent all lines and prepare them for the parser
        lines = indent_lines File.read(file), ' ' * indent
        lines << ' '

        # Indent all the output lines with the current indentation
        @code.insert @i + 1, *lines.lines
      end

      true
    end
921085
public function load($className)
    {
        if (isset($this->_classes[$className])) {
            $file = $this->_classes[$className];
            if (!is_file($file)) {
                trigger_error(strtr('load `:class` class failed: `:file` is not exists.', [':class' => $className, ':file' => $file]), E_USER_ERROR);
            }

            //either linux or phar://
            if (PHP_EOL === "\n" || $file[0] === 'p') {
                /** @noinspection PhpIncludeInspection */
                require $file;
            } else {
                $this->requireFile($file);
            }

            return true;
        }

        /** @noinspection LoopWhichDoesNotLoopInspection */
        foreach ($this->_namespaces as $namespace => $path) {
            if (strpos($className, $namespace) !== 0) {
                continue;
            }

            $file = $path . strtr(substr($className, strlen($namespace)), '\\', '/') . '.php';
            if (is_file($file)) {
                //either linux or phar://
                if (PHP_EOL === "\n" || $file[0] === 'p') {
                    /** @noinspection PhpIncludeInspection */
                    require $file;
                } else {
                    $this->requireFile($file);
                }

                return true;
            }
        }

        return false;
    }
355612
public static function autoload($className)
    {
        if (isset(self::$autoloadMap[$className])) {
            require self::$baseDir . self::$autoloadMap[$className];

            return true;
        }

        return false;
    }
417213
protected function includeTheFile($path) {
        $path = $this->urlBase    .$path;
        if(file_exists($path)) {
            /** @noinspection PhpIncludeInspection */
            require_once ($path);

            return true;
        }
        return false;
    }
1254052
public function setIncludesFile($includesFile)
    {
        if ($this->isReference()) {
            throw $this->tooManyAttributes();
        }
        if ($includesFile instanceof PhingFile) {
            $includesFile = $includesFile->getPath();
        }
        $o = $this->createIncludesFile();
        $o->setName($includesFile);
    }
545216
private boolean matchesExcludes( final String fileName )
    {
        for( Pattern include : m_excludes )
        {
            if( include.matcher( fileName ).matches() )
            {
                return true;
            }
        }
        return false;
    }