Пример #1
0
 /**
  * @return array
  */
 protected function resolveInfo() : array
 {
     return ['name' => $this->module->name(), 'title' => $this->module->title(), 'version' => $this->module->version(), 'description' => $this->module->description(), 'dependencies' => array_map(function (Module $module) {
         return $module->name();
     }, $this->module->dependencies()), 'dependents' => array_map(function (Module $module) {
         return $module->name();
     }, $this->module->dependents()), 'hidden' => $this->module->isHidden(), 'collector' => $this->module->collector(), 'installer' => $this->module->installer(), 'assets' => $this->module->assets()];
 }
Пример #2
0
 /**
  * Disable a module
  *
  * @param   Module $module
  * @param   boolean $recollect (optional)
  *
  * @return  boolean
  */
 public function disable(Module $module, bool $recollect = true) : bool
 {
     if (!$module->canBeDisabled()) {
         return false;
     }
     $config = $this->getConfig();
     $modules = $config->read('modules.enabled', array());
     $config->write('modules.enabled', array_diff($modules, array($module->name())));
     if (false !== ($installer = $module->installer())) {
         $this->getContainer()->make($installer)->disable();
     }
     $this->getComposerCLI()->dumpAutoload();
     $this->reloadClassLoader();
     if ($recollect) {
         $this->getCollector()->recollect();
     }
     $this->emit('module.disabled.' . $module->name());
     return true;
 }