public function configure(ConfigProviderInterface $cfg)
  {
    if($this->_configured)
    {
      return $this;
    }

    try
    {
      $config = $cfg->getSection('console');
      $commands = $config->getItem('commands', []);
      $patterns = $config->getItem('patterns', []);
    }
    catch(\Throwable $e)
    {
      $commands = $patterns = [];
    }

    $this->_searchPatterns = array_merge($this->_searchPatterns, $patterns);

    foreach($commands as $name => $class)
    {
      $command = $this->getCommandByString($class);
      if($command !== null)
      {
        if(!is_int($name))
        {
          $command->setName($name);
        }
        $this->add($command);
      }
    }

    $this->_configured = true;
    return $this;
  }
public function configure(ConfigProviderInterface $cfg)
  {
    if($this->_configured)
    {
      return $this;
    }

    try
    {
      $config = $cfg->getSection('console');
      $commands = $config->getItem('commands', []);
      $patterns = $config->getItem('patterns', []);
    }
    catch(\Throwable $e)
    {
      $commands = $patterns = [];
    }

    $this->_searchPatterns = array_merge($this->_searchPatterns, $patterns);

    foreach($commands as $name => $class)
    {
      $command = $this->getCommandByString($class);
      if($command !== null)
      {
        if(!is_int($name))
        {
          $command->setName($name);
        }
        $this->add($command);
      }
    }

    $this->_configured = true;
    return $this;
  }
public function configure ( ConfigProviderInterface $ cfg ) { if ( $ this -> _configured ) { return $ this ; } try { $ config = $ cfg -> getSection ( 'console' ) ; $ commands = $ config -> getItem ( 'commands' , [ ] ) ; $ patterns = $ config -> getItem ( 'patterns' , [ ] ) ; } catch ( \ Throwable $ e ) { $ commands = $ patterns = [ ] ; } $ this -> _searchPatterns = array_merge ( $ this -> _searchPatterns , $ patterns ) ; foreach ( $ commands as $ name => $ class ) { $ command = $ this -> getCommandByString ( $ class ) ; if ( $ command !== null ) { if ( ! is_int ( $ name ) ) { $ command -> setName ( $ name ) ; } $ this -> add ( $ command ) ; } } $ this -> _configured = true ; return $ this ; }
Pull the configuration from cubex and setup resolving patterns and
defined command lists

@param ConfigProviderInterface $cfg

@return $this
Pull the configuration from cubex and setup resolving patterns and defined command lists