original_string: public function init()
      {
          $grav = Grav::instance();
  
          /** @var Config $config */
          $config = $grav['config'];
  
          /** @var EventDispatcher $events */
          $events = $grav['events'];
  
          foreach ($this->items as $instance) {
              // Register only enabled plugins.
              if ($config["plugins.{$instance->name}.enabled"] && $instance instanceof Plugin) {
                  $instance->setConfig($config);
                  $events->addSubscriber($instance);
              }
          }
  
          return $this->items;
      }
code: public function init()
      {
          $grav = Grav::instance();
  
          /** @var Config $config */
          $config = $grav['config'];
  
          /** @var EventDispatcher $events */
          $events = $grav['events'];
  
          foreach ($this->items as $instance) {
              // Register only enabled plugins.
              if ($config["plugins.{$instance->name}.enabled"] && $instance instanceof Plugin) {
                  $instance->setConfig($config);
                  $events->addSubscriber($instance);
              }
          }
  
          return $this->items;
      }
code_tokens: public function init ( ) { $ grav = Grav :: instance ( ) ; /** @var Config $config */ $ config = $ grav [ 'config' ] ; /** @var EventDispatcher $events */ $ events = $ grav [ 'events' ] ; foreach ( $ this -> items as $ instance ) { // Register only enabled plugins. if ( $ config [ "plugins.{$instance->name}.enabled" ] && $ instance instanceof Plugin ) { $ instance -> setConfig ( $ config ) ; $ events -> addSubscriber ( $ instance ) ; } } return $ this -> items ; }
docstring: Registers all plugins.
  
  @return Plugin[] array of Plugin objects
  @throws \RuntimeException
docstring_tokens: Registers all plugins .