original_string: protected function _enable(PluginPackage $plugin)
      {
          $checker = new RuleChecker((array)$plugin->composer['require']);
          if (!$checker->check()) {
              $this->err(__d('installer', 'Plugin "{0}" cannot be enabled as some dependencies are disabled or not installed: {1}', $plugin->humanName, $checker->fail(true)));
  
              return false;
          }
  
          // MENTAL NOTE: As plugin is disabled its listeners are not attached to the
          // system, so we need to manually attach them in order to trigger callbacks.
          if (!$this->params['no-callbacks']) {
              $this->_attachListeners($plugin->name, "{$plugin->path}/");
              $trigger = $this->_triggerBeforeEvents($plugin);
              if (!$trigger) {
                  return false;
              }
          }
  
          return $this->_finish($plugin);
      }
code: protected function _enable(PluginPackage $plugin)
      {
          $checker = new RuleChecker((array)$plugin->composer['require']);
          if (!$checker->check()) {
              $this->err(__d('installer', 'Plugin "{0}" cannot be enabled as some dependencies are disabled or not installed: {1}', $plugin->humanName, $checker->fail(true)));
  
              return false;
          }
  
          // MENTAL NOTE: As plugin is disabled its listeners are not attached to the
          // system, so we need to manually attach them in order to trigger callbacks.
          if (!$this->params['no-callbacks']) {
              $this->_attachListeners($plugin->name, "{$plugin->path}/");
              $trigger = $this->_triggerBeforeEvents($plugin);
              if (!$trigger) {
                  return false;
              }
          }
  
          return $this->_finish($plugin);
      }
code_tokens: protected function _enable ( PluginPackage $ plugin ) { $ checker = new RuleChecker ( ( array ) $ plugin -> composer [ 'require' ] ) ; if ( ! $ checker -> check ( ) ) { $ this -> err ( __d ( 'installer' , 'Plugin "{0}" cannot be enabled as some dependencies are disabled or not installed: {1}' , $ plugin -> humanName , $ checker -> fail ( true ) ) ) ; return false ; } // MENTAL NOTE: As plugin is disabled its listeners are not attached to the // system, so we need to manually attach them in order to trigger callbacks. if ( ! $ this -> params [ 'no-callbacks' ] ) { $ this -> _attachListeners ( $ plugin -> name , "{$plugin->path}/" ) ; $ trigger = $ this -> _triggerBeforeEvents ( $ plugin ) ; if ( ! $ trigger ) { return false ; } } return $ this -> _finish ( $ plugin ) ; }
docstring: Activates the given plugin.
  
  @param \CMS\Core\Package\PluginPackage $plugin The plugin to enable
  @return bool True on success
docstring_tokens: Activates the given plugin .