Wikimedia\Composer\Merge\PluginState::loadSettings PHP Метод

loadSettings() публичный Метод

Load plugin settings
public loadSettings ( )
    public function loadSettings()
    {
        $extra = $this->composer->getPackage()->getExtra();
        $config = array_merge(array('include' => array(), 'require' => array(), 'recurse' => true, 'replace' => false, 'merge-dev' => true, 'merge-extra' => false, 'merge-extra-deep' => false), isset($extra['merge-plugin']) ? $extra['merge-plugin'] : array());
        $this->includes = is_array($config['include']) ? $config['include'] : array($config['include']);
        $this->requires = is_array($config['require']) ? $config['require'] : array($config['require']);
        $this->recurse = (bool) $config['recurse'];
        $this->replace = (bool) $config['replace'];
        $this->mergeDev = (bool) $config['merge-dev'];
        $this->mergeExtra = (bool) $config['merge-extra'];
        $this->mergeExtraDeep = (bool) $config['merge-extra-deep'];
    }

Usage Example

Пример #1
0
 /**
  * Handle an event callback for an install, update or dump command by
  * checking for "merge-plugin" in the "extra" data and merging package
  * contents if found.
  *
  * @param Event $event
  */
 public function onInstallUpdateOrDump(Event $event)
 {
     $this->state->loadSettings();
     $this->state->setDevMode($event->isDevMode());
     $this->mergeFiles($this->state->getIncludes(), false);
     $this->mergeFiles($this->state->getRequires(), true);
     if ($event->getName() === ScriptEvents::PRE_AUTOLOAD_DUMP) {
         $this->state->setDumpAutoloader(true);
         $flags = $event->getFlags();
         if (isset($flags['optimize'])) {
             $this->state->setOptimizeAutoloader($flags['optimize']);
         }
     }
 }