original_string: protected function _enable()
      {
          $disabledPlugins = plugin()
              ->filter(function ($plugin) {
                  return !$plugin->status && !$plugin->isTheme;
              })
              ->toArray();
  
          if (!count($disabledPlugins)) {
              $this->err(__d('installer', '<info>There are no disabled plugins!</info>'));
              $this->out();
  
              return;
          }
  
          $index = 1;
          $this->out();
          foreach ($disabledPlugins as $plugin) {
              $disabledPlugins[$index] = $plugin;
              $this->out(__d('installer', '[{0, number, integer}] {1}', [$index, $plugin->humanName]));
              $index++;
          }
          $this->out();
  
          $message = __d('installer', "Which plugin would you like to activate?\n[Q]uit");
          while (true) {
              $in = $this->in($message);
              if (strtoupper($in) === 'Q') {
                  $this->err(__d('installer', 'Operation aborted'));
                  break;
              } elseif (intval($in) < 1 || !isset($disabledPlugins[intval($in)])) {
                  $this->err(__d('installer', 'Invalid option'));
              } else {
                  $task = $this->dispatchShell("Installer.plugins toggle -p {$disabledPlugins[$in]->name} -s enable");
  
                  if ($task === 0) {
                      $this->out(__d('installer', 'Plugin enabled!'));
                      Plugin::dropCache();
                  } else {
                      $this->err(__d('installer', 'Plugin could not be enabled.'), 2);
                      $this->out();
                  }
                  break;
              }
          }
  
          $this->out();
      }
code: protected function _enable()
      {
          $disabledPlugins = plugin()
              ->filter(function ($plugin) {
                  return !$plugin->status && !$plugin->isTheme;
              })
              ->toArray();
  
          if (!count($disabledPlugins)) {
              $this->err(__d('installer', '<info>There are no disabled plugins!</info>'));
              $this->out();
  
              return;
          }
  
          $index = 1;
          $this->out();
          foreach ($disabledPlugins as $plugin) {
              $disabledPlugins[$index] = $plugin;
              $this->out(__d('installer', '[{0, number, integer}] {1}', [$index, $plugin->humanName]));
              $index++;
          }
          $this->out();
  
          $message = __d('installer', "Which plugin would you like to activate?\n[Q]uit");
          while (true) {
              $in = $this->in($message);
              if (strtoupper($in) === 'Q') {
                  $this->err(__d('installer', 'Operation aborted'));
                  break;
              } elseif (intval($in) < 1 || !isset($disabledPlugins[intval($in)])) {
                  $this->err(__d('installer', 'Invalid option'));
              } else {
                  $task = $this->dispatchShell("Installer.plugins toggle -p {$disabledPlugins[$in]->name} -s enable");
  
                  if ($task === 0) {
                      $this->out(__d('installer', 'Plugin enabled!'));
                      Plugin::dropCache();
                  } else {
                      $this->err(__d('installer', 'Plugin could not be enabled.'), 2);
                      $this->out();
                  }
                  break;
              }
          }
  
          $this->out();
      }
code_tokens: protected function _enable ( ) { $ disabledPlugins = plugin ( ) -> filter ( function ( $ plugin ) { return ! $ plugin -> status && ! $ plugin -> isTheme ; } ) -> toArray ( ) ; if ( ! count ( $ disabledPlugins ) ) { $ this -> err ( __d ( 'installer' , '<info>There are no disabled plugins!</info>' ) ) ; $ this -> out ( ) ; return ; } $ index = 1 ; $ this -> out ( ) ; foreach ( $ disabledPlugins as $ plugin ) { $ disabledPlugins [ $ index ] = $ plugin ; $ this -> out ( __d ( 'installer' , '[{0, number, integer}] {1}' , [ $ index , $ plugin -> humanName ] ) ) ; $ index ++ ; } $ this -> out ( ) ; $ message = __d ( 'installer' , "Which plugin would you like to activate?\n[Q]uit" ) ; while ( true ) { $ in = $ this -> in ( $ message ) ; if ( strtoupper ( $ in ) === 'Q' ) { $ this -> err ( __d ( 'installer' , 'Operation aborted' ) ) ; break ; } elseif ( intval ( $ in ) < 1 || ! isset ( $ disabledPlugins [ intval ( $ in ) ] ) ) { $ this -> err ( __d ( 'installer' , 'Invalid option' ) ) ; } else { $ task = $ this -> dispatchShell ( "Installer.plugins toggle -p {$disabledPlugins[$in]->name} -s enable" ) ; if ( $ task === 0 ) { $ this -> out ( __d ( 'installer' , 'Plugin enabled!' ) ) ; Plugin :: dropCache ( ) ; } else { $ this -> err ( __d ( 'installer' , 'Plugin could not be enabled.' ) , 2 ) ; $ this -> out ( ) ; } break ; } } $ this -> out ( ) ; }
docstring: Activates a plugin.
  
  @return void
docstring_tokens: Activates a plugin .