Cake\Console\Shell::__construct PHP Method

__construct() public method

Constructs this Shell instance.
public __construct ( ConsoleIo $io = null )
$io ConsoleIo An io instance.
    public function __construct(ConsoleIo $io = null)
    {
        if (!$this->name) {
            list(, $class) = namespaceSplit(get_class($this));
            $this->name = str_replace(['Shell', 'Task'], '', $class);
        }
        $this->_io = $io ?: new ConsoleIo();
        $locator = $this->tableLocator() ?: 'Cake\\ORM\\TableRegistry';
        $this->modelFactory('Table', [$locator, 'get']);
        $this->Tasks = new TaskRegistry($this);
        $this->_mergeVars(['tasks'], ['associative' => ['tasks']]);
        $this->_io->setLoggers(true);
        if (isset($this->modelClass)) {
            $this->loadModel();
        }
    }

Usage Example

Beispiel #1
6
 /**
  * {@inheritDoc}
  */
 public function __construct(ConsoleIo $io = null)
 {
     parent::__construct($io);
     if (strtolower(substr(php_uname('s'), 0, 3)) === 'win') {
         $this->_mkdirCommand = 'mkdir';
     }
 }
All Usage Examples Of Cake\Console\Shell::__construct