mark autoload service definition from service provider

@param array $autoloads name of service. service alias
@param string|ServiceProvider $provider service provider
@param array options: shared, instances, prefix
426520
public function autoload(array $autoloads, $provider, $options = [])
    {
        foreach ($autoloads as $name => $alias) {
            if (is_int($name)) {
                $name = $alias;
            }
            if (empty($name)) {
                throw new \InvalidArgumentException("Cannot not autoload empty service");
            }
            if (!empty($options['prefix'])) {
                $alias = $options['prefix'] . ucfirst($alias);
            }
            $shared = true;
            if (isset($options['shared'])) {
                if (is_array($options['shared'])) {
                    $shared = in_array($name, $options['shared']);
                } else {
                    $shared = $options['shared'];
                }
            } elseif (isset($options['instances'])) {
                $shared = !in_array($name, $options['instances']);
            }
            $this->set($alias, function () use ($name, $provider) {
                if (!is_object($provider)) {
                    $provider = $this->getShared($provider);
                }
                return $provider->provide($name, func_get_args());
            }, $shared);
        }
        return $this;
    }
1300536
public function registerProviders(array $providers = []): self
    {
        foreach ($providers as $provider) {
            $this->registerProvider($provider);
        }

        return $this;
    }
785841
public function createLoader(array $autoloads)
    {
        $loader = new ClassLoader();

        if (isset($autoloads['psr-0'])) {
            foreach ($autoloads['psr-0'] as $namespace => $path) {
                $loader->add($namespace, $path);
            }
        }

        if (isset($autoloads['psr-4'])) {
            foreach ($autoloads['psr-4'] as $namespace => $path) {
                $loader->addPsr4($namespace, $path);
            }
        }

        return $loader;
    }
274958
private function autoload_plugins($scheduler)
  {
    if (env('DEV_AUTOLOAD_PLUGINS') == true) {
      $plugins = config('app.plugins');

      foreach($plugins as $plugin => $class) {
        $class::schedule($scheduler);
      }
    }
  }
372065
public function load(array $configs, ContainerBuilder $container)
    {
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
        $loader->load('services.xml');

        $config = $this->processConfiguration(new Configuration(), $configs);

        if (!empty($config['unalias_subscriber'])) {
            // deprecation, remove in next major
            trigger_error('unalias_subscriber is no longer used. This has moved to form transformers.', E_USER_DEPRECATED);
        }


        if (isset($config['static_ref'])) {
            $container->getDefinition('zicht_url.static_refs')->addMethodCall('addAll', [$config['static_ref']]);
        }
        if (!empty($config['aliasing']) && $config['aliasing']['enabled'] === true) {
            $this->loadAliasingConfig($container, $config['aliasing'], $loader);
            $container->setAlias('zicht_url.sitemap_provider', new Alias('zicht_url.alias_sitemap_provider'));
        } else {
            $container->setAlias('zicht_url.sitemap_provider', new Alias('zicht_url.provider'));
        }
        if (!empty($config['logging'])) {
            $loader->load('logging.xml');
        }
        if (!empty($config['admin'])) {
            $loader->load('admin.xml');
        }
        if (!empty($aliasingConfig) && $config['caching']['enabled'] === true) {
            $loader->load('cache.xml');
            $subscriberDefinition = $container->getDefinition('zicht_url.cache_subscriber');
            $subscriberDefinition->replaceArgument(1, $config['caching']['entities']);
        }
        if (!empty($config['db_static_ref']) && $config['db_static_ref']['enabled'] === true) {
            $loader->load('db.xml');
        }

        if ($container->hasDefinition('zicht_url.aliasing')) {
            $container->getDefinition('zicht_url.twig_extension')->addArgument(new Reference('zicht_url.aliasing'));
        }

        if ($container->hasDefinition('zicht_url.mapper.html')) {
            $container->getDefinition('zicht_url.mapper.html')->addMethodCall('addAttributes', [$config['html_attributes']]);
        }

        if ($container->hasDefinition('zicht_url.listener.strict_public_url')) {
            $container->getDefinition('zicht_url.listener.strict_public_url')->replaceArgument(0, $config['strict_public_url']);
        }

        if ($container->hasDefinition('zicht_url.validator.contains_url_alias')) {
            $container->getDefinition('zicht_url.validator.contains_url_alias')->replaceArgument(1, $config['strict_public_url']);
        }

        $formResources = $container->getParameter('twig.form.resources');
        $formResources[] = 'ZichtUrlBundle::form_theme.html.twig';
        $container->setParameter('twig.form.resources', $formResources);
    }
601290
protected function setThemeAutoloading()
    {
        foreach ($this->config->get('theme.autoloading', []) as $ns => $path) {
            $path = $this->dirPath.'/'.trim($path, '\/');
            $this->loader->addPsr4($ns, $path);
        }

        $this->loader->register();
    }
517491
public function load(Application $app, array $providers)
    {
        $manifest = $this->loadManifest();

        // First we will load the service manifest, which contains information on all
        // service providers registered with the application and which services it
        // provides. This is used to know which services are "deferred" loaders.
        if ($this->shouldRecompile($manifest, $providers)) {
            $manifest = $this->compileManifest($app, $providers);
        }

        // If the application is running in the console, we will not lazy load any of
        // the service providers. This is mainly because it's not as necessary for
        // performance and also so any provided Artisan commands get registered.
        if ($app->runningInConsole()) {
            $manifest['eager'] = $manifest['providers'];
        }

        // Next, we will register events to load the providers for each of the events
        // that it has requested. This allows the service provider to defer itself
        // while still getting automatically loaded when a certain event occurs.
        foreach ($manifest['when'] as $provider => $events) {
            $this->registerLoadEvents($app, $provider, $events);
        }

        // We will go ahead and register all of the eagerly loaded providers with the
        // application so their services can be registered with the application as
        // a provided service. Then we will set the deferred service list on it.
        foreach ($manifest['eager'] as $provider) {
            $app->register($this->createProvider($app, $provider));
        }

        $app->setDeferredServices($manifest['deferred']);
    }
1129293
public static function load($files = [], $options = null)
    {
        if (! self::$configurator instanceof ConfiguratorClass) {
            self::$configurator = new ConfiguratorClass($files, $options);
        } else {
            self::$configurator->load($files, $options);
        }
    }
402666
public function loadDeferredProvider($service)
    {
        if (!isset($this->deferredServices[$service])) {
            return;
        }
        $provider = $this->deferredServices[$service];

        // If the service provider has not already been loaded and registered we can
        // register it with the application and remove the service from this list
        // of deferred services, since it will already be loaded on subsequent.
        if (!isset($this->registeredProviders[$provider])) {
            $this->registerDeferredProvider($provider, $service);
        }
    }
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);
        }
    }
1165461
public function autoload($assets)
    {
        foreach ($assets as $position => $collections) {
            if (property_exists($this, $position)) {

                if ($collections instanceof \ArrayObject) {
                    $collections = $collections->getArrayCopy();
                }

                $this->{$position}->loadCollections($collections);
            } elseif ($position === 'packages') {
                $this->loadPackages($collections);
            } elseif ($position === 'css') {
                $this->loadCss($collections);
            } elseif ($position === 'js') {
                $this->loadJs($collections);
            }
        }
    }
1153148
public function registerDeferredProvider($provider, $service = null)
	{
		// Once the provider that provides the deferred service has been registered we
		// will remove it from our local list of the deferred services with related
		// providers so that this container does not try to resolve it out again.
		if ($service) unset($this->deferredServices[$service]);

		$this->register($instance = new $provider($this));

		if ( ! $this->booted)
		{
			$this->booting(function() use ($instance)
			{
				$this->bootProvider($instance);
			});
		}
	}
957485
protected function getFilesPath(array $autoloads, bool $withClassmap): array
    {
        $allPath = [];

        foreach ($autoloads as $name => $autoload) {
            $prefix = $name;

            $filePath = $autoload['files'] ?? [];
            // "files" and "classmap" have a very similar behavior
            if ($withClassmap) {
                $filePath = array_merge($filePath, $autoload['classmap'] ?? []);
            }
            // Flatten path, as you can specify multiple path for one namespace
            $filePath = array_reduce(
                $filePath,
                /**
                 * @param string[]        $carry
                 * @param string[]|string $item
                 *
                 * @return string[]
                 */
                function (array $carry, $item): array {
                    if (\is_array($item)) {
                        return array_merge($carry, $item);
                    }
                    $carry[] = $item;

                    return $carry;
                },
                []
            );
            if (!is_int($prefix)) {
                // Add the package name (<=> path in vendor dir)
                $filePath = array_map(function (string $path) use ($prefix): string {
                    return $prefix . DIRECTORY_SEPARATOR . $path;
                }, $filePath);
            }
            $allPath = array_merge($allPath, $filePath);
        }

        return $allPath;
    }
29188
protected function loadDeferredProvider($service)
	{
		$provider = $this->deferredServices[$service];

		// If the service provider has not already been loaded and registered we can
		// register it with the application and remove the service from this list
		// of deferred services, since it will already be loaded on subsequent.
		if ( ! isset($this->loadedProviders[$provider]))
		{
			$this->registerDeferredProvider($provider, $service);
		}
	}
792656
public function setLoaders($loaders)
    {
        if ($loaders instanceof LoaderInterface) {
            $loaders = [$loaders];
        }

        foreach ($loaders as $name => $loader) {
            $this->setLoader($name, $loader);
        }
    }
771479
protected function loadProviders($providers)
	{
		foreach ((array) $providers as $provider) {
			$provider = $this->container->get($provider);

			if (!$provider instanceof ServiceProviderInterface) {
				$providerName = get_class($provider);
				throw new \Exception(
					"$providerName does not implement required \\TitaPHP\\Foundation\\ServiceProviderInterface Interface"
				);
			}

			$provider->register($this);
		}
	}
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;
    }