Yosymfony\Spress\Core\Plugin\PluginManager::getPluginCollection PHP Method

getPluginCollection() public method

Gets the plugin collection.
public getPluginCollection ( ) : Yosymfony\Spress\Core\Support\Collection
return Yosymfony\Spress\Core\Support\Collection The plugin collection
    public function getPluginCollection()
    {
        return $this->pluginCollection;
    }

Usage Example

 /**
  * Builds the PluginManager with the plugins of a site.
  *
  * Each plugin is added to PluginManager using "name"
  * meta or its classname if that meta do not exists.
  *
  * @return \Yosymfony\Spress\Core\Plugin\PluginManager
  */
 public function build()
 {
     $pm = new PluginManager($this->eventDispatcher);
     $pluginCollection = $pm->getPluginCollection();
     if (empty($this->path) === true || file_exists($this->path) === false) {
         return $pm;
     }
     $composerClassname = [];
     $finder = $this->buildFinder();
     foreach ($finder as $file) {
         $classname = $this->getClassname($file);
         if (empty($classname) === true) {
             continue;
         }
         if ($file->getFilename() === $this->composerFilename) {
             $composerClassname[] = $classname;
             continue;
         }
         include_once $file->getRealPath();
         if ($this->isValidClassName($classname) === false) {
             continue;
         }
         $plugin = new $classname();
         $metas = $this->getPluginMetas($plugin);
         $pluginCollection->add($metas['name'], $plugin);
     }
     foreach ($composerClassname as $classname) {
         if ($this->isValidClassName($classname) === true) {
             $plugin = new $classname();
             $metas = $this->getPluginMetas($plugin);
             $pluginCollection->add($metas['name'], $plugin);
         }
     }
     return $pm;
 }
All Usage Examples Of Yosymfony\Spress\Core\Plugin\PluginManager::getPluginCollection