Builds the PluginManager with the plugins of a site.

Each plugin is added to PluginManager using "name"
meta or its classname if that meta does not exists.

@return PluginManager PluginManager filled with the valid plugins
7855
public function build()
    {
        $pm = new PluginManager($this->eventDispatcher);
        $pluginCollection = $pm->getPluginCollection();

        if (file_exists($this->path) === false) {
            return $pm;
        }

        $classnamesFromComposerFile = [];

        $finder = $this->buildFinder();

        foreach ($finder as $file) {
            if ($file->getFilename() === $this->composerFilename) {
                $classes = $this->getClassnamesFromComposerFile($file);
                $classnamesFromComposerFile = array_merge($classnamesFromComposerFile, $classes);

                continue;
            }

            $classname = $this->getClassnameFromPHPFilename($file);

            include_once $file->getRealPath();

            if ($this->hasImplementedPluginInterface($classname) === false) {
                continue;
            }

            $this->addPluginToCollection($classname, $pluginCollection);
        }

        foreach ($classnamesFromComposerFile as $classname) {
            if ($this->hasImplementedPluginInterface($classname) === true) {
                $this->addPluginToCollection($classname, $pluginCollection);
            }
        }

        return $pm;
    }
636222
public function buildCommands()
    {
        $result = [];
        $pluginsCollection = $this->pluginManager->getPluginCollection();

        foreach ($pluginsCollection as $plugin) {
            if ($this->isValidCommandPlugin($plugin) === true) {
                $result[] = $this->buildCommand($plugin);
            }
        }

        return $result;
    }
278332
public function getVendorAndPluginNames()
    {
        $plugins = [];

        $dirPath = plugins_path();
        if (!File::isDirectory($dirPath)) {
            return $plugins;
        }

        $it = new RecursiveIteratorIterator(
            new RecursiveDirectoryIterator($dirPath, RecursiveDirectoryIterator::FOLLOW_SYMLINKS)
        );
        $it->setMaxDepth(2);
        $it->rewind();

        while ($it->valid()) {
            if (($it->getDepth() > 1) && $it->isFile() && (strtolower($it->getFilename()) == "plugin.php")) {
                $filePath = dirname($it->getPathname());
                $pluginName = basename($filePath);
                $vendorName = basename(dirname($filePath));
                $plugins[$vendorName][$pluginName] = $filePath;
            }

            $it->next();
        }

        return $plugins;
    }
413343
public function build()
    {
        $cm = $this->builder->getClassMetadata();

        $cm->mapEmbedded($this->mapping);

        return $this->builder;
    }
1350817
public Plugin[] getPlugins() {
		if (mPluginContext != null) {
			Collection c = mPluginContext.getPlugins().values();
			if (c != null) {
				return (Plugin[])c.toArray(new Plugin[c.size()]);
			}
		}
		return new Plugin[0];
	}
1206707
public function Metadata()
    {
        // variables
        $config = SiteConfig::current_site_config();
        // begin SEO
        $metadata = PHP_EOL . $this->owner->MarkupComment('SEO');
        // register extension update hook
        $this->owner->extend('updateMetadata', $config, $this->owner, $metadata);
        // end
        $metadata .= $this->owner->MarkupComment('END SEO');
        // return
        return $metadata;
    }
96994
private Set<Artifact> getProjectPluginManagement() {
        Set<Artifact> result = new LinkedHashSet<Artifact>();
        PluginManagement pluginManagement = getProject().getPluginManagement();
        if (pluginManagement != null) {
            for (Plugin plugin : pluginManagement.getPlugins()) {
                result.add(toArtifact(plugin));
            }
        }
        return result;
    }
735680
public function setPluginManager(Navigation\PluginManager $plugins)
    {
        if ($this->view) {
            $plugins->setView($this->view);
        }
        $this->plugins = $plugins;
        return $this;
    }
825148
protected function build()
    {
        $page = Typo3GeneralUtility::_GP('page');

        /** @var \Metaseo\Metaseo\Sitemap\Generator\XmlGenerator $generator */
        $generator = $this->objectManager->get('Metaseo\\Metaseo\\Sitemap\\Generator\\XmlGenerator');

        if (empty($page) || $page === 'index') {
            return $generator->sitemapIndex();
        } else {
            return $generator->sitemap($page);
        }
    }
566302
protected function getTemplateManager()
    {
        if (null === $this->templateManager) {
            $this->templateManager = new TemplateManager($this->profiler, $this->twig, $this->templates);
        }

        return $this->templateManager;
    }
548838
protected function setUpEntityManagers()
    {
        $managers    = [];
        $connections = [];

        foreach ($this->config['managers'] as $manager => $settings) {
            $managerName    = IlluminateRegistry::getManagerNamePrefix() . $manager;
            $connectionName = IlluminateRegistry::getConnectionNamePrefix() . $manager;

            // Bind manager
            $this->app->singleton($managerName, function () use ($settings) {

                $manager = EntityManager::create(
                    ConnectionManager::resolve(array_get($settings, 'connection')),
                    MetaDataManager::resolve(array_get($settings, 'meta'))
                );

                $configuration = $manager->getConfiguration();

                // Listeners
                if (isset($settings['events']['listeners'])) {
                    foreach ($settings['events']['listeners'] as $event => $listener) {
                        $manager->getEventManager()->addEventListener($event, $listener);
                    }
                }

                // Subscribers
                if (isset($settings['events']['subscribers'])) {
                    foreach ($settings['events']['subscribers'] as $subscriber) {
                        $manager->getEventManager()->addEventSubscriber($subscriber);
                    }
                }

                // Filters
                if (isset($settings['filters'])) {
                    foreach ($settings['filters'] as $name => $filter) {
                        $configuration->getMetadataDriverImpl()->addFilter($name, $filter);
                        $manager->getFilters()->enable($name);
                    }
                }

                // Paths
                $configuration->getMetadataDriverImpl()->addPaths(
                    array_get($settings, 'paths', [])
                );

                // Repository
                $configuration->setDefaultRepositoryClassName(
                    array_get($settings, 'repository', \Doctrine\ORM\EntityRepository::class)
                );

                $configuration->setAutoGenerateProxyClasses(
                    array_get($settings, 'proxies.auto_generate', false)
                );

                if ($namespace = array_get($settings, 'proxies.namespace', false)) {
                    $configuration->setProxyNamespace($namespace);
                }

                return $manager;
            });

            // Bind connection
            $this->app->singleton($connectionName, function ($app) use ($manager) {
                $app->make(IlluminateRegistry::getManagerNamePrefix() . $manager)->getConnection();
            });

            $managers[$manager]    = $manager;
            $connections[$manager] = $manager;
        }

        return [$managers, $connections];
    }
1308575
public function getPackageManager() {
		if ($this->packageManager === null) {
			$this->packageManager = new PackageManager($this);
		}

		return $this->packageManager;
	}
998053
function moduleManager()
    {
        if (! $this->moduleManager ) {
            $mm = new ModuleManager;
            $mm->setTarget($this);
            $this->moduleManager = $mm;
        }

        return $this->moduleManager;
    }
779393
public function dir()
    {
        $pm = new PluginManager(new EventDispatcher());
        if ($this->registerPlugins) {
            $pm->registerPlugins();
        }

        $plugins = $pm->getPlugins();
        $rows    = array();

        foreach ($plugins as $plugin) {
            if (!$plugin instanceof EventSubscriberInterface) {
                $events = array();
            } else {
                $events = $plugin::getSubscribedEvents();
            }
            $rows[get_class($plugin)] = array_keys($events);
        }

        return $rows;
    }
375830
private function createManager()
    {
        $config = $this->generateConfig();

        $algoliaManager = $this->algoliaFactory->make($config);
        $algoliaManager->setEnv($this->env);

        return $algoliaManager;
    }
810918
public function getModuleManager() {
		if ($this->moduleManager === null) {
			$this->moduleManager = new ModuleManager($this);
		}

		return $this->moduleManager;
	}
961885
public <P extends PluginRepository<?, ?>> P getPluginManager(Class<?> pluginType) {
        return (P) pluginRepositories.get(pluginType);
    }