original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: 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
docstring_tokens: Builds the PluginManager with the plugins of a site .