Example #1
0
 /**
  * Internal routine for parsing global options from the command line
  *
  * @return null
  */
 protected function _parseGlobalPart()
 {
     $getoptOptions = array();
     $getoptOptions['help|h'] = 'HELP';
     $getoptOptions['verbose|v'] = 'VERBOSE';
     $getoptOptions['pretend|p'] = 'PRETEND';
     $getoptOptions['debug|d'] = 'DEBUG';
     $getoptParser = new \Zend\Console\Getopt($getoptOptions, $this->_argumentsWorking, array('parseAll' => false));
     // @todo catch any exceptions here
     $getoptParser->parse();
     foreach ($getoptParser->getOptions() as $option) {
         if ($option == 'pretend') {
             $this->_request->setPretend(true);
         } elseif ($option == 'debug') {
             $this->_request->setDebug(true);
         } elseif ($option == 'verbose') {
             $this->_request->setVerbose(true);
         } else {
             $property = '_' . $option;
             $this->{$property} = true;
         }
     }
     $this->_argumentsWorking = $getoptParser->getRemainingArgs();
     return;
 }