Searches specified directories for classes, and build autoload arrays.

@throws Exception if desired output directory is not a directory, or if
the autoload arrays are not writeable by the script.
@return void
544185
public function buildAutoloadArrays()
    {
        $phpFiles = $this->fetchFiles();

        $phpClasses = array();
        foreach ( $phpFiles as $mode => $fileList )
        {
            $phpClasses[$mode] = $this->getClassFileList( $fileList, $mode );
        }

        $maxClassNameLength = $this->checkMaxClassLength( $phpClasses );
        $this->autoloadArrays = $this->dumpArray( $phpClasses, $maxClassNameLength );

        if ( $this->options->writeFiles )
        {
            $this->writeAutoloadFiles();
        }
    }
611620
public function load($data_folder = '')
  {
    $loader = new DataLoader();
    $this->data = $loader->load($data_folder, '/config.json');
    if (!$this->validator->validate($this->data)) {
      throw new \Exception('Config.json fail.');
    }
  }
39241
public static function autoload($class)
  {
    if(substr($class, 0, strlen(__CLASS__)) != __CLASS__) return;

    try
    {
      self::loadClass($class);

      return TRUE;
    }
    catch(Exception $e)
    {
      return FALSE;
    }
  }
131782
public function autoload($classpath)
    {
        $this->_registeredNamespace = false;

        list($namespace, $classname) = $this->normalizeClassname($classpath);

        if ($this->autoloadThrowWrappers($namespace, $classname) || $this->autoloadThrowFilesystem($namespace, $classname)) {
            if (NAMESPACE_SEPARATOR == substr($classpath, 0, 1)) {
                $classpath = substr($classpath, 1);
            }

            if (null !== $this->getEventDispatcher() && is_subclass_of($classpath, 'BackBee\ClassContent\AbstractClassContent')) {
                $this->getEventDispatcher()->triggerEvent('include', new $classpath());
            }

            return;
        }

        if (true === $this->_registeredNamespace) {
            throw new Exception\ClassNotFoundException(sprintf('Class %s%s%s not found.', $namespace, NAMESPACE_SEPARATOR, $classname));
        }
    }
867263
private function prepareDistDirectory()
	{
		$build = $this->getBuildFolder();

		if (!file_exists($build))
		{
			$this->_mkdir($build);
		}

		$this->cleanup($build);
	}
723823
public function autoload($className)
    {
        if ($this->namespace == null || $this->namespace.'\\' === substr($className, 0, strlen($this->namespace.'\\'))) {
            $fileName = dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR;
            $namespace = '';
            if (false !== ($lastNsPos = strripos($className, '\\'))) {
                $namespace = substr($className, 0, $lastNsPos);
                $className = substr($className, $lastNsPos + 1);
                $fileName .= str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
            }
            $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
            require $fileName;
        }
    }
1081408
private function loadDirectory()
    {
        if ($this->generator === null) {
            return;
        }

        foreach ($this->generator as $file) {
            $this->files = $this->files->put(
                (string) $file->name(),
                $file
            );
        }

        $this->generator = null;
    }
1360380
public static function register(){
		if( self::$registered ){
			return;
		}

		self::$libDir = dirname(__FILE__);

		if(false === spl_autoload_register(array('Less_Autoloader', 'loadClass'))){
			throw new Exception('Unable to register Less_Autoloader::loadClass as an autoloading method.');
		}

		self::$registered = true;
	}
72727
private function preload(): void
    {
        $iterator = new \RecursiveIteratorIterator(
            new \RecursiveDirectoryIterator(
                __DIR__
            )
        );

        /** @var \SplFileInfo $file */
        foreach ($iterator as $file) {
            if ($file->isFile() && $file->getExtension() === 'php') {
                require_once $file->getRealPath();
            }
        }

        $definedClasses = get_declared_classes();
        /** @var string $definedClass */
        foreach ($definedClasses as $definedClass) {
            try {
                $reflection = new \ReflectionClass($definedClass);
                if ($reflection->implementsInterface(PreloadInterface::class)) {
                    $callback = [$definedClass, 'preload'];
                    assert(is_callable($callback));
                    call_user_func($callback, $this->composer);
                }
            } catch (\ReflectionException $e) {
                continue;
            }
        }
    }
1221998
public static function autocreate_directory($directory)
    {
        if (!file_exists($directory)) {
            mkdir($directory, 0777, true);
        }

        if (!is_writable($directory)) {
            throw new \Exception("Directory \"{$directory}\" is not writable");
        }
    }
656506
public function init()
    {
        parent::init();

        if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
            $this->windows = true;
        }

        if ($this->resource_directory) {
            if (!file_exists($this->resource_directory)) {
                throw new Exception('Invalid resource directory', 1);
            }
        }
    }
604299
public function autoload( $class ) {

		// Iterate over namespaces to find a match.
		foreach ( $this->namespaces as $namespace ) {

			// Move on if the object does not belong to the current namespace.
			if ( 0 !== strpos( $class, $namespace['root'] ) ) {
				continue;
			}

			// Remove namespace root level to correspond with root filesystem, and
			// replace the namespace separator "\" by the system-dependent directory separator.
			$filename = str_replace(
				array( $namespace['root'], '\\' ),
				array( '', DIRECTORY_SEPARATOR ),
				$class
			);

			// Remove a leading backslash from the class name.
			$filename = $this->remove_leading_backslash( $filename );

			// Change to lower case if requested.
			if ( $namespace['lowercase'] ) {
				$filename = strtolower( $filename );
			}

			// Change underscores into hyphens if requested.
			if ( $namespace['underscores'] ) {
				$filename = str_replace( '_', '-', $filename );
			}

			// Add base_dir, prefix and suffix.
			$filepath = $namespace['base_dir']
				. $namespace['prefix']
				. $filename
				. $namespace['suffix'];

			// Throw an exception if the file does not exist or is not readable.
			if ( is_readable( $filepath ) ) {
				require_once $filepath;
			}
		}
	}
501755
public function registerClassLoader() : void
    {
        if ($this->root === null) {
            return;
        }

        $path = sprintf('%s/%s/autoload.php', $this->root, $this->getVendorDirectory());

        if (!is_file($path)) {
            return;
        }

        require $path;
    }
710421
private static function plugins()
    {
        $files = ['Plugins'];
        $folder = static::$root.'Plugins'.'/';

        self::call($files, $folder);

        $files = ['AutoloadFileNotFoundException', 'InfoStructureException'];
        $folder = static::$root.'Plugins/Exceptions'.'/';

        self::call($files, $folder);
    }
1061114
protected function createFolders()
    {
        $dir    = null;
        $target = $this->getTargetDirectory();

        /** @noinspection IsEmptyFunctionUsageInspection */
        if (!empty($target)) {
            $dir = rtrim($target, '/') . DIRECTORY_SEPARATOR;
            $this->setTarget($dir);
        }

        if ($dir !== null && !is_dir($dir) && $this->isAllowCreateFolders()) {
            /** @noinspection NotOptimalIfConditionsInspection */
            /** @noinspection PhpUsageOfSilenceOperatorInspection */
            if (!@mkdir($dir, 0777, true) && !is_dir($dir)) {
                throw new Exception\NoSuchDirectoryException(
                    sprintf('Directory %s does not exists.', $dir)
                );
            }
        }
    }
1365272
public static function autoload()
    {
        // Vendor path
        $dir_base = realpath(__DIR__ . '/../../../../');

        $finder = new Finder();
        $finder->files()
            ->ignoreVCS(true)
            ->ignoreDotFiles(false)
            ->name('service.yml')
            ->exclude('Tests')
            ->exclude('tests')
            ->in($dir_base);

        foreach ($finder as $file) {
            self::autoloadFile($file);
        }
    }
371209
private static function init(): void
    {
        if (static::$initialized === false) {
            $baseClass = Base::getInstance();

            static::$initialized = true;
            static::$logDir = $baseClass->parsePath((string)$baseClass->Log->logDirectory);
            static::$classConfig = $baseClass->Log->classConfig->toArray();

            if (static::$logDir != '') {
                Directory::create(static::$logDir);
            }
        }
    }