Example #1
0
 /**
  * Internal routine for parsing the action name from the arguments
  *
  * @return null
  */
 protected function _parseActionPart()
 {
     // the next "word" should be the action name
     $consoleActionName = array_shift($this->_argumentsWorking);
     if ($consoleActionName == '?') {
         $this->_help = true;
         return;
     }
     $actionSearchCriteria = array('type' => 'Tool', 'name' => 'actionName', 'value' => $consoleActionName, 'clientName' => 'console');
     // is the action name valid?
     $actionMetadata = $this->_manifestRepository->getMetadata($actionSearchCriteria);
     // check for normalized names as well (all lower, no separators)
     if (!$actionMetadata) {
         $actionSearchCriteria['name'] = 'normalizedActionName';
         $actionSearchCriteria['value'] = strtolower(str_replace(array('-', '_'), '', $consoleActionName));
         $actionSearchCriteria['clientName'] = 'all';
         $actionMetadata = $this->_manifestRepository->getMetadata($actionSearchCriteria);
     }
     // if no action, handle error
     if (!$actionMetadata) {
         throw new Exception\RuntimeException(sprintf('Action "%s" is not a valid action.', $consoleActionName));
     }
     // prepare action request name
     $this->_helpKnownAction = true;
     $this->_request->setActionName($actionMetadata->getActionName());
     return;
 }