Cake\Console\ShellDispatcher::_createShell PHP Method

_createShell() protected method

Create the given shell name, and set the plugin property
protected _createShell ( string $className, string $shortName ) : Shell
$className string The class name to instantiate
$shortName string The plugin-prefixed shell name
return Shell A shell instance.
    protected function _createShell($className, $shortName)
    {
        list($plugin) = pluginSplit($shortName);
        $instance = new $className();
        $instance->plugin = trim($plugin, '.');
        return $instance;
    }

Usage Example

 /**
  * Create the given shell name, and set the plugin property.
  *
  * @param string $className The class name to instantiate
  * @param string $shortName The plugin-prefixed shell name
  * @return \Cake\Console\Shell A shell instance.
  */
 protected function _createShell($className, $shortName)
 {
     $instance = parent::_createShell($className, $shortName);
     $webIo = new ConsoleIo(new WebConsoleOutput(), new WebConsoleOutput(), new WebConsoleInput());
     $instance->io($webIo);
     return $instance;
 }