original_string: public static function load($plugin, array $config = [])
      {
          deprecationWarning(
              'Plugin::load() is deprecated. ' .
              'Use Application::addPlugin() instead. ' .
              'This method will be removed in 4.0.0.'
          );
  
          if (is_array($plugin)) {
              foreach ($plugin as $name => $conf) {
                  list($name, $conf) = is_numeric($name) ? [$conf, $config] : [$name, $conf];
                  static::load($name, $conf);
              }
  
              return;
          }
  
          $config += [
              'autoload' => false,
              'bootstrap' => false,
              'routes' => false,
              'console' => true,
              'classBase' => 'src',
              'ignoreMissing' => false,
              'name' => $plugin
          ];
  
          if (!isset($config['path'])) {
              $config['path'] = static::getCollection()->findPath($plugin);
          }
  
          $config['classPath'] = $config['path'] . $config['classBase'] . DIRECTORY_SEPARATOR;
          if (!isset($config['configPath'])) {
              $config['configPath'] = $config['path'] . 'config' . DIRECTORY_SEPARATOR;
          }
          $pluginClass = str_replace('/', '\\', $plugin) . '\\Plugin';
          if (class_exists($pluginClass)) {
              $instance = new $pluginClass($config);
          } else {
              // Use stub plugin as this method will be removed long term.
              $instance = new BasePlugin($config);
          }
          static::getCollection()->add($instance);
  
          if ($config['autoload'] === true) {
              if (empty(static::$_loader)) {
                  static::$_loader = new ClassLoader();
                  static::$_loader->register();
              }
              static::$_loader->addNamespace(
                  str_replace('/', '\\', $plugin),
                  $config['path'] . $config['classBase'] . DIRECTORY_SEPARATOR
              );
              static::$_loader->addNamespace(
                  str_replace('/', '\\', $plugin) . '\Test',
                  $config['path'] . 'tests' . DIRECTORY_SEPARATOR
              );
          }
  
          if ($config['bootstrap'] === true) {
              static::bootstrap($plugin);
          }
      }
code: public static function load($plugin, array $config = [])
      {
          deprecationWarning(
              'Plugin::load() is deprecated. ' .
              'Use Application::addPlugin() instead. ' .
              'This method will be removed in 4.0.0.'
          );
  
          if (is_array($plugin)) {
              foreach ($plugin as $name => $conf) {
                  list($name, $conf) = is_numeric($name) ? [$conf, $config] : [$name, $conf];
                  static::load($name, $conf);
              }
  
              return;
          }
  
          $config += [
              'autoload' => false,
              'bootstrap' => false,
              'routes' => false,
              'console' => true,
              'classBase' => 'src',
              'ignoreMissing' => false,
              'name' => $plugin
          ];
  
          if (!isset($config['path'])) {
              $config['path'] = static::getCollection()->findPath($plugin);
          }
  
          $config['classPath'] = $config['path'] . $config['classBase'] . DIRECTORY_SEPARATOR;
          if (!isset($config['configPath'])) {
              $config['configPath'] = $config['path'] . 'config' . DIRECTORY_SEPARATOR;
          }
          $pluginClass = str_replace('/', '\\', $plugin) . '\\Plugin';
          if (class_exists($pluginClass)) {
              $instance = new $pluginClass($config);
          } else {
              // Use stub plugin as this method will be removed long term.
              $instance = new BasePlugin($config);
          }
          static::getCollection()->add($instance);
  
          if ($config['autoload'] === true) {
              if (empty(static::$_loader)) {
                  static::$_loader = new ClassLoader();
                  static::$_loader->register();
              }
              static::$_loader->addNamespace(
                  str_replace('/', '\\', $plugin),
                  $config['path'] . $config['classBase'] . DIRECTORY_SEPARATOR
              );
              static::$_loader->addNamespace(
                  str_replace('/', '\\', $plugin) . '\Test',
                  $config['path'] . 'tests' . DIRECTORY_SEPARATOR
              );
          }
  
          if ($config['bootstrap'] === true) {
              static::bootstrap($plugin);
          }
      }
code_tokens: public static function load ( $ plugin , array $ config = [ ] ) { deprecationWarning ( 'Plugin::load() is deprecated. ' . 'Use Application::addPlugin() instead. ' . 'This method will be removed in 4.0.0.' ) ; if ( is_array ( $ plugin ) ) { foreach ( $ plugin as $ name => $ conf ) { list ( $ name , $ conf ) = is_numeric ( $ name ) ? [ $ conf , $ config ] : [ $ name , $ conf ] ; static :: load ( $ name , $ conf ) ; } return ; } $ config += [ 'autoload' => false , 'bootstrap' => false , 'routes' => false , 'console' => true , 'classBase' => 'src' , 'ignoreMissing' => false , 'name' => $ plugin ] ; if ( ! isset ( $ config [ 'path' ] ) ) { $ config [ 'path' ] = static :: getCollection ( ) -> findPath ( $ plugin ) ; } $ config [ 'classPath' ] = $ config [ 'path' ] . $ config [ 'classBase' ] . DIRECTORY_SEPARATOR ; if ( ! isset ( $ config [ 'configPath' ] ) ) { $ config [ 'configPath' ] = $ config [ 'path' ] . 'config' . DIRECTORY_SEPARATOR ; } $ pluginClass = str_replace ( '/' , '\\' , $ plugin ) . '\\Plugin' ; if ( class_exists ( $ pluginClass ) ) { $ instance = new $ pluginClass ( $ config ) ; } else { // Use stub plugin as this method will be removed long term. $ instance = new BasePlugin ( $ config ) ; } static :: getCollection ( ) -> add ( $ instance ) ; if ( $ config [ 'autoload' ] === true ) { if ( empty ( static :: $ _loader ) ) { static :: $ _loader = new ClassLoader ( ) ; static :: $ _loader -> register ( ) ; } static :: $ _loader -> addNamespace ( str_replace ( '/' , '\\' , $ plugin ) , $ config [ 'path' ] . $ config [ 'classBase' ] . DIRECTORY_SEPARATOR ) ; static :: $ _loader -> addNamespace ( str_replace ( '/' , '\\' , $ plugin ) . '\Test' , $ config [ 'path' ] . 'tests' . DIRECTORY_SEPARATOR ) ; } if ( $ config [ 'bootstrap' ] === true ) { static :: bootstrap ( $ plugin ) ; } }
docstring: Loads a plugin and optionally loads bootstrapping,
  routing files or runs an initialization function.
  
  Plugins only need to be loaded if you want bootstrapping/routes/cli commands to
  be exposed. If your plugin does not expose any of these features you do not need
  to load them.
  
  This method does not configure any autoloaders. That must be done separately either
  through composer, or your own code during config/bootstrap.php.
  
  ### Examples:
  
  `Plugin::load('DebugKit')`
  
  Will load the DebugKit plugin and will not load any bootstrap nor route files.
  However, the plugin will be part of the framework default routes, and have its
  CLI tools (if any) available for use.
  
  `Plugin::load('DebugKit', ['bootstrap' => true, 'routes' => true])`
  
  Will load the bootstrap.php and routes.php files.
  
  `Plugin::load('DebugKit', ['bootstrap' => false, 'routes' => true])`
  
  Will load routes.php file but not bootstrap.php
  
  `Plugin::load('FOC/Authenticate')`
  
  Will load plugin from `plugins/FOC/Authenticate`.
  
  It is also possible to load multiple plugins at once. Examples:
  
  `Plugin::load(['DebugKit', 'ApiGenerator'])`
  
  Will load the DebugKit and ApiGenerator plugins.
  
  `Plugin::load(['DebugKit', 'ApiGenerator'], ['bootstrap' => true])`
  
  Will load bootstrap file for both plugins
  
  ```
  Plugin::load([
  'DebugKit' => ['routes' => true],
  'ApiGenerator'
  ],
  ['bootstrap' => true])
  ```
  
  Will only load the bootstrap for ApiGenerator and only the routes for DebugKit
  
  ### Configuration options
  
  - `bootstrap` - array - Whether or not you want the $plugin/config/bootstrap.php file loaded.
  - `routes` - boolean - Whether or not you want to load the $plugin/config/routes.php file.
  - `ignoreMissing` - boolean - Set to true to ignore missing bootstrap/routes files.
  - `path` - string - The path the plugin can be found on. If empty the default plugin path (App.pluginPaths) will be used.
  - `classBase` - The path relative to `path` which contains the folders with class files.
  Defaults to "src".
  - `autoload` - boolean - Whether or not you want an autoloader registered. This defaults to false. The framework
  assumes you have configured autoloaders using composer. However, if your application source tree is made up of
  plugins, this can be a useful option.
  
  @param string|array $plugin name of the plugin to be loaded in CamelCase format or array or plugins to load
  @param array $config configuration options for the plugin
  @throws \Cake\Core\Exception\MissingPluginException if the folder for the plugin to be loaded is not found
  @return void
  @deprecated 3.7.0 This method will be removed in 4.0.0. Use Application::addPlugin() instead.
docstring_tokens: Loads a plugin and optionally loads bootstrapping routing files or runs an initialization function .