Loads an interceptor autoloader.

@param  array   $loader The autoloader to use.
@return boolean         Returns `true` on success, `false` otherwise.
761977
public static function load($interceptor = null)
    {
        if (static::$_interceptor) {
            static::unpatch();
        }

        $original = $interceptor->originalLoader();
        $success = spl_autoload_register($interceptor->loader(), true, true);
        spl_autoload_unregister($original);

        static::$_interceptor = $interceptor;
        return $success;
    }
953360
protected function initChoices($loader)
    {
        $this->choices = $loader->retrieveAll(array('online' => true))->reduce(function ($r, Page $page) {
            $r[$page->getName()] = $page->getId();

            return $r;
        }, array());

        return $this;
    }
792656
public function setLoaders($loaders)
    {
        if ($loaders instanceof LoaderInterface) {
            $loaders = [$loaders];
        }

        foreach ($loaders as $name => $loader) {
            $this->setLoader($name, $loader);
        }
    }
1062055
public function getLoaders()
    {
        $loaders = array();
        foreach ($this->validators as $validator) {
            $loaders[$validator->getName()] = $validator->getLoader();
        }

        return $loaders;
    }
334546
public static function createFromAssetsLoader(AssetsLoader $loader)
    {
        $_class = get_called_class();
        return new $_class(
            $loader->getRootDirectory(),
            $loader->getAssetsDirectory(),
            $loader->getVendorDirectory(),
            $loader->getAssetsVendorDirectory()
        );
    }
1048538
public function setLoader($name, LoaderInterface $loader)
    {
        // If name is int or null, get name from Loader object.
        $name = (is_numeric($name) || !$name) ? $loader->getName() : $name;

        $this->loaders[$name] = $loader;

        return $this;
    }
1202215
public static function setLoader($loader) {
    if (!$loader) {
      self::$_loader = NULL;
      return;
    }
    if ($loader instanceof FluentDOM\Loadable) {
      self::$_loader = $loader;
      return;
    }
    throw new FluentDOM\Exceptions\InvalidArgument(
      'loader', [Loadable::class]
    );
  }
274688
final protected function executeLoaders(array $loaders)
    {
        $arguments = func_get_args();
        array_shift($arguments);

        foreach ($loaders as $method) {
            if (method_exists($this, $method)) {
                $this->log(
                    "Calling function \"{$method}\": Actual memory usage before method: " . $this->getMemoryUsageString(
                    ),
                    ShopgateLogger::LOGTYPE_DEBUG
                );
                try {
                    $result = call_user_func_array(array($this, $method), $arguments);
                } catch (ShopgateLibraryException $e) {
                    // pass through known Shopgate Cart Integration SDK Exceptions
                    throw $e;
                } catch (Exception $e) {
                    $msg = "An unknown exception has been thrown in loader method \"{$method}\". Memory usage "
                        . $this->getMemoryUsageString() . " Exception '" . get_class(
                            $e
                        ) . "': [Code: {$e->getCode()}] {$e->getMessage()}";
                    throw new ShopgateLibraryException(
                        ShopgateLibraryException::UNKNOWN_ERROR_CODE,
                        $msg, true,
                        true,
                        $e
                    );
                }

                if ($result) {
                    $arguments[0] = $result;
                }
            }
        }

        return $arguments[0];
    }
21263
public function loadClass( $class ) {

		if ( ! isset( $this->class_map[ $class ] ) )
			return FALSE;

		return $this->loader->loadFile( $this->class_map[ $class ] );
	}
1157374
public function addLoaders(array $loaders) {
        foreach ($loaders as $loader) {
            if (is_string($loader)) {
                $loader = new $loader();
            }

            if (!$loader instanceof InputLoaderInterface) {
                $name = is_object($loader) ? get_class($loader) : (string) $loader;
                throw new InvalidArgumentException('Given loader (' . $name . ') does not implement LoaderInterface', 500);
            }

            $this->registerLoader($loader);
        }

        return $this;
    }
1252142
protected function _autoload($class)
    {
        $callback = $this->getDefaultAutoloader();
        try {
            if ($this->suppressNotFoundWarnings()) {
                @call_user_func($callback, $class);
            } else {
                call_user_func($callback, $class);
            }
            return $class;
        } catch (Zend_Exception $e) {
            return false;
        }
    }
768374
public function load( $class ) {

    // do not import class that is exists already
    if( static::exist( $class ) ) return true;
    else {

      // fix for absolute class definitions
      $class = ltrim( $class, '\\' );

      $path = explode( '\\', $class );
      $name = array_pop( $path );

      // try first the custom paths (custom autoload path support)
      foreach( $this->definition as $namespace => list( $directory, $length ) ) {
        if( strpos( $class, $namespace ) === 0 ) {

          // return when the loader find a perfect match, and the class really exist
          if( $this->search( $name, array_slice( $path, $length ), $directory ) && static::exist( $class ) ) {
            return true;
          }
        }
      }

      return false;
    }
  }
6391
private function extractSupportedLoaders(array $loaders)
    {
        $supportedLoaders = [];

        foreach ($loaders as $loader) {
            if ($loader instanceof XmlFileLoader || $loader instanceof YamlFileLoader) {
                $supportedLoaders[] = $loader;
            } elseif ($loader instanceof LoaderChain) {
                $supportedLoaders = array_merge($supportedLoaders, $this->extractSupportedLoaders($loader->getLoaders()));
            }
        }

        return $supportedLoaders;
    }
592841
private function getLoader(): LoaderInterface
    {
        if (null !== $this->loader) {
            return $this->loader;
        }

        if (null !== $this->localFile) {
            $this->loader = new Local($this->localFile);

            return $this->loader;
        }

        if (extension_loaded('curl')) {
            $this->loader = new Curl($this);

            return $this->loader;
        }

        $streamHelper = new StreamCreator($this);

        if (ini_get('allow_url_fopen')) {
            $this->loader = new FopenLoader($this, $streamHelper);

            return $this->loader;
        }

        $this->loader = new SocketLoader($this, $streamHelper);

        return $this->loader;
    }
693102
public function resolveLoader($resource)
    {
        foreach ($this->loaders as $loader) {
            if ($loader->supports($resource)) {
                return $loader;
            }
        }

        return null;
    }
1011537
public function autoload($class)
    {
        $isFallback = $this->isFallbackAutoloader();
        if (false !== strpos($class, self::NS_SEPARATOR)) {
            if ($this->loadClass($class, self::LOAD_NS)) {
                return $class;
            } elseif ($isFallback) {
                return $this->loadClass($class, self::ACT_AS_FALLBACK);
            }
            return false;
        }
        if (false !== strpos($class, self::PREFIX_SEPARATOR)) {
            if ($this->loadClass($class, self::LOAD_PREFIX)) {
                return $class;
            } elseif ($isFallback) {
                return $this->loadClass($class, self::ACT_AS_FALLBACK);
            }
            return false;
        }
        if ($isFallback) {
            return $this->loadClass($class, self::ACT_AS_FALLBACK);
        }
        return false;
    }
1059224
public function getLoader(): LoaderInterface
    {
        if (!isset($this->i__loader)) {
            $this->i__loader = new DelegateLoader();
        }

        return $this->i__loader;
    }