Example #1
0
 /**
  * Add a partner
  *
  * This is the add partner method. It literally does what it say.
  * It adds a partner.
  *
  * @return void
  */
 public function addAction()
 {
     $this->_helper->viewRenderer->setViewSuffix('txt');
     // The options we are accepting for adding
     $options = new Zend_Console_Getopt(array('first-name|fn=s' => $this->tr->_('FIRSTNAME'), 'last-name|ln=s' => $this->tr->_('LASTNAME'), 'email|e=s' => $this->tr->_('EMAIL_USERNAME'), 'company|c=s' => $this->tr->_('COMPANY')));
     try {
         $options->parse();
     } catch (Zend_Console_Getopt_Exception $e) {
         $this->view->message = $e->getUsageMessage();
         $this->render();
         return;
     }
     if ($options->getOption('first-name') == '' || $options->getOption('last-name') == '' || $options->email == '' || $options->company == '') {
         $this->view->message = $options->getUsageMessage();
         return;
     }
     $partner_first_name = $options->getOption('first-name');
     $partner_last_name = $options->getOption('last-name');
     $partner_email = $options->email;
     $partner_company = $options->company;
     $submit_data = array('firstname' => $partner_first_name, 'lastname' => $partner_last_name, 'email' => $partner_email, 'company' => $partner_company);
     $model = new Default_Model_Partner();
     try {
         $model->add($submit_data);
         $this->view->message = 'Successfully added partner: ' . $partner_email . PHP_EOL;
     } catch (RuntimeException $e) {
         $this->view->message = 'Error adding partner: ' . $partner_email . '. ' . $e->getMessage() . PHP_EOL;
     }
 }
 /**
  * 构造函数,初始化日志文件目录。
  */
 protected function __construct()
 {
     try {
         $console = new Zend_Console_Getopt(array('logroot|l=s' => 'the Log Server root directory', 'logdir|d=s' => 'this log file directory', 'logfile|f=s' => 'the log files', 'delay|a=i' => 'delay timestamp', 'start|s=s' => 'start datetime', 'end|e=s' => 'end datetime'));
         if (!$console->getOptions()) {
             throw new ZtChart_Model_Monitor_Console_Exception($console->getUsageMessage());
         }
         if (null !== ($logServerRootDirectory = $console->getOption('l'))) {
             foreach (array_diff(scandir($logServerRootDirectory), array('.', '..')) as $directory) {
                 $this->_logDirectories[] = realpath($logServerRootDirectory) . DIRECTORY_SEPARATOR . $directory;
             }
         }
         if (null !== ($logDirectories = $console->getOption('d'))) {
             $this->_logDirectories += $logDirectories;
         }
         if (null !== ($logFiles = $console->getOption('f'))) {
             $this->_logFiles = explode(' ', $logFiles);
         }
         if (null !== ($delayTimestamp = $console->getOption('a'))) {
             $this->_delayTimestamp = $delayTimestamp;
         }
         if (null !== ($startTimestamp = $console->getOption('s'))) {
             $this->_startTimestamp = $startTimestamp;
         }
         if (null !== ($endTimestamp = $console->getOption('e'))) {
             $this->_endTimestamp = $endTimestamp;
         }
     } catch (Zend_Console_Getopt_Exception $e) {
         throw new ZtChart_Model_Monitor_Console_Exception($e->getMessage());
     }
     $this->_console = $console;
 }
 private function configure()
 {
     $zend_console = new Zend_Console_Getopt(array('create|c' => 'Create database configureation', 'adapter|a=w' => 'Database adapter (mysql)', 'host|h=w' => 'Default to localhost', 'username|u=w' => 'Username to connect to database', 'password|p=w' => 'Password to connect to database', 'database|d=w' => 'Database Name', 'port|o-i' => '(optional) Port for connecting to database', 'socket|s-w' => '(optional) Location for database socket'), $this->argv);
     try {
         echo $a = $zend_console->getOption('a');
         echo $h = $zend_console->getOption('h');
         // Load all sections from an existing config file, while skipping the extends.
         $config = new Zend_Config_Ini(SMCONFIG_DIRECTORY . DIRECTORY_SEPARATOR . 'database.ini', null, array('skipExtends' => true, 'allowModifications' => true));
         // Modify values
         $config->database->doctrine_adapter = $zend_console->getOption('a');
         $config->database->params->host = $zend_console->getOption('h');
         $config->database->params->username = $zend_console->getOption('u');
         $config->database->params->password = $zend_console->getOption('p');
         $config->database->params->dbname = $zend_console->getOption('d');
         $config->database->params->port = $zend_console->getOption('h');
         $config->database->params->socket = $zend_console->getOption('h');
         // Write the config file
         $writer = new Zend_Config_Writer_Ini(array('config' => $config, 'filename' => 'config.ini'));
         $writer->write();
         //*/
     } catch (Zend_Console_Getopt_Exception $e) {
         fwrite(STDOUT, "Connection Failed\n");
         echo $e->getUsageMessage();
         exit;
     }
 }
 /**
  * Get option value
  *
  * @param string $key
  * @param mixed $default
  *
  * @return mixed|null
  */
 public static function getOption($key, $default = null)
 {
     if (!static::$_getopt instanceof \Zend_Console_Getopt) {
         return $default;
     }
     $value = static::$_getopt->getOption($key);
     if (is_null($value)) {
         return $default;
     }
     return $value;
 }
 public function compileSchema()
 {
     if (!$this->opts->getOption('dest')) {
         throw new RuntimeException("Specify destination folder (--dest PATH)");
     }
     if (!$this->opts->getOption('schema')) {
         throw new RuntimeException("Specify path to XML Schema file (--schema PATH)");
     }
     $schema = $this->opts->getOption('schema');
     if (!file_exists($schema)) {
         throw new RuntimeException("Schema file " . $schema . " is not found");
     }
     $dest = $this->opts->getOption('dest');
     $this->legko->compileSchema($schema, $dest);
     $this->println("Bindings successfully generated in " . realpath($dest));
 }
Example #6
0
 /**
  * method to sync the options received from cli with the possible options
  * if options is mandatory and not received return false
  * 
  * @param type $possibleOptions
  * 
  * @return mixed array of options if all mandatory options received, else false
  */
 public function getInstanceOptions($possibleOptions = null)
 {
     if (is_null($possibleOptions)) {
         $possibleOptions = array('type' => false, 'stamp' => false, 'path' => "./", 'parser' => 'fixed');
     }
     $options = array();
     //Retrive  the command line  properties
     //		foreach($this->options->getRemainingArgs() as  $cmdLineArg) {
     //			$seperatedCmdStr = !strpos('=',$cmdLineArg) ? split("=", $cmdLineArg) : split(" ", $cmdLineArg);
     //			$inLineOpt = isset($seperatedCmdStr[1]) ?  $seperatedCmdStr[1] : true;
     //			foreach (array_reverse(split("\.", $seperatedCmdStr[0])) as $field) {
     //				$inLineOpt = array( $field => $inLineOpt);
     //			}
     //			$options['cmd_opts'] = array_merge_recursive( (isset($options['cmd_opts']) ? $options['cmd_opts'] : array() ), $inLineOpt );
     //		}
     foreach ($possibleOptions as $key => $defVal) {
         $options[$key] = $this->options->getOption($key);
         if (is_null($options[$key])) {
             if (!$defVal) {
                 $this->addOutput("Error: No {$key} selected");
                 return false;
             } else {
                 if (true !== $defVal) {
                     $options[$key] = $defVal;
                 } else {
                     unset($options[$key]);
                 }
             }
         }
     }
     return $options;
 }
Example #7
0
 /**
  * Creates the new project
  * @throws Exception
  */
 public function createProject()
 {
     $force = !!$this->console->getOption('force');
     $realAppPath = realpath($this->appPath) . DIRECTORY_SEPARATOR;
     $realLibraryPath = realpath(dirname(__FILE__) . '/../') . DIRECTORY_SEPARATOR;
     $libraryPath = 'Library/';
     while (!file_exists($this->appPath . $libraryPath) && strpos($realAppPath, $realLibraryPath) === 0) {
         $libraryPath = '../' . $libraryPath;
     }
     foreach ($this->projectFiles as $projectFile => $projectFileValue) {
         if (is_int($projectFile)) {
             $projectFile = $projectFileValue;
             $projectFileValue = array();
         }
         if (file_exists($this->appPath . $projectFile) && !$force) {
             throw new Exception('Project file "' . $projectFile . '" already exists failure.');
         }
         if (substr($projectFile, -1) === '/') {
             if (!file_exists($this->appPath . $projectFile)) {
                 mkdir($this->appPath . $projectFile, 0777, !empty($projectFileValue['recursive']));
             }
             if (isset($projectFileValue['chmod'])) {
                 $old = umask(0);
                 chmod($this->appPath . $projectFile, $projectFileValue['chmod']);
                 umask($old);
             }
         } else {
             $fileContent = isset($projectFileValue['content']) ? $projectFileValue['content'] : '';
             $fileContent = str_replace(array('%app%', '%appPath%', '%libraryPath%'), array($this->app, $this->appPath, $libraryPath), $fileContent);
             file_put_contents($this->appPath . $projectFile, $fileContent);
         }
     }
 }
Example #8
0
 /**
  * Get option value by name
  *
  * @param string $sName
  * @return string
  */
 protected final function _getOption($sName)
 {
     $sOption = $this->_oGetopt->getOption($sName);
     if (is_null($sOption) && !is_null($this->_aExpectedOptions[$sName]['default'])) {
         $sOption = $this->_aExpectedOptions[$sName]['default'];
     }
     return $sOption;
 }
Example #9
0
 public function __construct()
 {
     $flags = array('--' . $this->getActionKey(), '-a', '--' . $this->getControllerKey(), '-c', '--' . $this->getModuleKey(), '-m');
     $argv = array($_SERVER['argv'][0]);
     foreach ($_SERVER['argv'] as $key => $value) {
         if (in_array($value, $flags)) {
             $argv[] = $value;
             $argv[] = $_SERVER['argv'][$key + 1];
         }
     }
     require_once 'Zend/Console/Getopt.php';
     $getopt = new Zend_Console_Getopt($this->_getGetoptRules(), $argv);
     $getopt->parse();
     $this->setModuleName($getopt->getOption($this->getModuleKey()));
     $this->setControllerName($getopt->getOption($this->getControllerKey()));
     $this->setActionName($getopt->getOption($this->getActionKey()));
 }
Example #10
0
 function __construct($process_classes_folder)
 {
     $this->Logger = \Logger::getLogger('JobLauncher');
     $processes = @glob("{$process_classes_folder}/class.*Process.php");
     $options = array();
     if (count($processes) > 0) {
         foreach ($processes as $process) {
             $filename = basename($process);
             $directory = dirname($process);
             if (!file_exists($directory . "/" . $filename)) {
                 throw new \Exception(sprintf("File %s does not exist.", $directory . "/" . $filename));
             }
             include_once $directory . "/" . $filename;
             preg_match("/class.(.*)Process.php/s", $filename, $tmp);
             $process_name = $tmp[1];
             if (class_exists("{$process_name}Process")) {
                 $reflect = new \ReflectionClass("{$process_name}Process");
                 if ($reflect) {
                     if ($reflect->implementsInterface('Scalr\\System\\Pcntl\\ProcessInterface')) {
                         $options[$process_name] = $reflect->getProperty("ProcessDescription")->getValue($reflect->newInstance());
                     } else {
                         throw new \Exception("Class '{$process_name}Process' doesn't implement 'ProcessInterface'.", E_ERROR);
                     }
                 } else {
                     throw new \Exception("Cannot use ReflectionAPI for class '{$process_name}Process'", E_ERROR);
                 }
             } else {
                 throw new \Exception("'{$process}' does not contain definition for '{$process_name}Process'", E_ERROR);
             }
         }
     } else {
         throw new \Exception(_("No job classes found in {$process_classes_folder}"), E_ERROR);
     }
     $options["help"] = "Print this help";
     $options["piddir=s"] = "PID directory";
     $Getopt = new \Zend_Console_Getopt($options);
     try {
         $opts = $Getopt->getOptions();
     } catch (\Zend_Console_Getopt_Exception $e) {
         print "{$e->getMessage()}\n\n";
         die($Getopt->getUsageMessage());
     }
     if (in_array("help", $opts) || count($opts) == 0 || !$options[$opts[0]]) {
         print $Getopt->getUsageMessage();
         exit;
     } else {
         $this->ProcessName = $opts[0];
         if (in_array("piddir", $opts)) {
             $piddir = trim($Getopt->getOption("piddir"));
             if (substr($piddir, 0, 1) != '/') {
                 $this->PIDDir = realpath($process_classes_folder . "/" . $piddir);
             } else {
                 $this->PIDDir = $piddir;
             }
         }
     }
 }
Example #11
0
function main()
{
    prepareEnvironment();
    try {
        $opts = new Zend_Console_Getopt(array('create application|a=s' => 'create application option with required string parameter', 'help' => 'help option with no required parameter'));
        $opts->parse();
    } catch (Zend_Console_Getopt_Exception $e) {
        echo $e->getUsageMessage();
        exit;
    }
    if ($applicationName = $opts->getOption('a')) {
        create(APPLICATION, array($applicationName));
        exit;
    }
    if ($opts->getOption('h')) {
        echo $e->getUsageMessage();
        exit;
    }
}
Example #12
0
 public function route(Zend_Controller_Request_Abstract $dispatcher)
 {
     try {
         $opts = new Zend_Console_Getopt(array('help|h' => 'prints this usage information', 'action|a=s' => 'action name (default: index)', 'controller|c=s' => 'controller name  (default: index)', 'verbose|v' => 'explain what is being done'));
         $opts->parse();
     } catch (Zend_Console_Getopt_Exception $e) {
         echo $e->getMessage() . "\n\n" . $e->getUsageMessage();
         exit(1);
     }
     if ($opts->getOption("help")) {
         echo $opts->getUsageMessage();
         exit;
     }
     if (!$opts->getOption("action")) {
         $opts->setOption("action", "index");
     }
     if (!$opts->getOption("controller")) {
         $opts->setOption("controller", "index");
     }
     $dispatcher->setControllerName($opts->getOption("controller"))->setActionName($opts->getOption("action"));
 }
Example #13
0
 public function parse()
 {
     // get actionname from arguments
     if (count($this->_arguments) == 0) {
         return;
     }
     // action name will be a free floating string
     $actionName = array_shift($this->_arguments);
     // check to make sure that the action exists
     if (!($actionContext = $this->_buildManifest->getContext('action', $actionName)) instanceof Zend_Build_Manifest_Context) {
         require_once 'Zend/Tool/Cli/Context/Exception.php';
         throw new Zend_Tool_Cli_Context_Exception('No action context by name ' . $actionName . ' was found in the manifest.');
     }
     $getoptRules = array();
     // get the attributes from this action context
     $actionContextAttrs = $actionContext->getAttributes();
     foreach ($actionContextAttrs as $actionContextAttr) {
         if (isset($actionContextAttr['attributes']['getopt'])) {
             $getoptRules[$actionContextAttr['attributes']['getopt']] = $actionContextAttr['usage'];
         }
     }
     // parse those options out of the arguments array
     $getopt = new Zend_Console_Getopt($getoptRules, $this->_arguments, array('parseAll' => false));
     $getopt->parse();
     // put remaining args into local property
     $this->_arguments = $getopt->getRemainingArgs();
     // get class name
     $actionClassName = $actionContext->getClassName();
     // load appropriate file
     try {
         Zend_Loader::loadClass($actionClassName);
     } catch (Zend_Loader_Exception $e) {
         echo 'couldnt load ' . $actionClassName . PHP_EOL;
     }
     // get actual object for class name
     $this->_action = new $actionClassName();
     // make sure its somewhat sane (implements proper interface)
     if (!$this->_action instanceof Zend_Build_Action_Abstract) {
         echo 'does not implement Zend_Build_Action_Abstract ' . PHP_EOL;
     }
     $parameters = array();
     foreach ($getopt->getOptions() as $getoptParsedOption) {
         $parameters[$getoptParsedOption] = $getopt->getOption($getoptParsedOption);
     }
     $this->_action->setParameters($parameters);
     $this->_action->validate();
     $this->setExecutable();
     return;
     // everything succeeded
 }
Example #14
0
 /**
  * Processes a request and sets its controller and action.  If
  * no route was possible, an exception is thrown.
  *
  * @param  \Zend_Controller_Request_Abstract
  * @throws \Zend_Controller_Router_Exception
  * @return \Zend_Controller_Request_Abstract|boolean
  */
 public function route(\Zend_Controller_Request_Abstract $request)
 {
     $options = array('help|h' => 'Show this help', 'org|o=i' => 'The user organization number', 'pwd|p=s' => 'User password', 'user|u=s' => 'The user name');
     $getopt = new \Zend_Console_Getopt($options);
     try {
         $getopt->parse();
     } catch (\Zend_Console_Getopt_Exception $e) {
         echo $this->_expandMessage($e);
         exit;
     }
     if ($getopt->getOption('h')) {
         // $getopt->s
         echo $this->_expandMessage($getopt);
         exit;
     }
     if ($request instanceof \MUtil_Controller_Request_Cli) {
         $request->setUserLogin($getopt->getOption('u'), $getopt->getOption('o'), $getopt->getOption('p'));
     }
     $arguments = $getopt->getRemainingArgs();
     if ($arguments) {
         $controller = array_shift($arguments);
         $action = array_shift($arguments);
         if (!$action) {
             $action = 'index';
         }
         if (preg_match('/^\\w+(-\\w+)*$/', $controller) && preg_match('/^\\w+(-\\w+)*$/', $action)) {
             $request->setControllerName($controller);
             $request->setActionName($action);
             $params[$request->getControllerKey()] = $controller;
             $params[$request->getActionKey()] = $action;
             foreach ($arguments as $arg) {
                 if (\MUtil_String::contains($arg, '=')) {
                     list($name, $value) = explode('=', $arg, 2);
                 } else {
                     $name = $arg;
                     $value = '';
                 }
                 $params[$name] = $value;
             }
             $request->setParams($params);
             return $request;
         }
         echo "Invalid command: {$controller}/{$action}.\n", exit;
     }
     echo "No command given.\n\n";
     echo $this->_expandMessage($getopt), exit;
 }
function main()
{
    prepareEnvironment();
    try {
        $opts = new Zend_Console_Getopt(array('create application|a=s' => 'create application option with required string parameter', 'help' => 'help option with no required parameter'));
        $opts->parse();
    } catch (Zend_Console_Getopt_Exception $e) {
        echo $e->getUsageMessage();
        exit;
    }
    if ($applicationName = $opts->getOption('a')) {
        echo create(APPLICATION, array($applicationName));
        exit;
    }
    echo "UNEXPECTED ERROR: missing argument. Type tn -help to see parameters \n";
    exit;
}
 public function route(Zend_Controller_Request_Abstract $dispatcher)
 {
     $getopt = new Zend_Console_Getopt(array());
     $getopt->addRules(array('controller|c=s' => 'Controller Name', 'action|a=s' => 'Controller Action', 'from|f=s' => 'From yyyy-mm-dd', 'to|t=s' => 'To yyyy-mm-dd'));
     $arguments = $getopt->getRemainingArgs();
     if ($getopt->getOption('controller') && $getopt->getOption('action')) {
         $dispatcher->setControllerName($getopt->getOption('controller'));
         $dispatcher->setActionName($getopt->getOption('action'));
         $dispatcher->setParams(array('from' => $getopt->getOption('from'), 'to' => $getopt->getOption('to')));
         return $dispatcher;
     }
 }
Example #17
0
 /**
  * @param \Zend_Console_Getopt $opt
  * @SuppressWarnings(PHPMD.NPathComplexity)
  * @throws \Zend_Console_Getopt_Exception
  */
 public function __construct(\Zend_Console_Getopt $opt)
 {
     $this->locale = $opt->getOption('locale') ?: $this->locale;
     if (!$opt->getOption('ext')) {
         throw new \Zend_Console_Getopt_Exception('Provide "ext" parameter!');
     }
     $this->ext = $opt->getOption('ext');
     if (!preg_match('/^[a-z]{2}_[A-Z]{2}$/', $this->locale)) {
         throw new \Zend_Console_Getopt_Exception('Invalid locale format');
     }
     $this->area = $opt->getOption('area') ?: $this->area;
     $this->theme = $opt->getOption('theme') ?: $this->theme;
     if ($opt->getOption('files')) {
         $this->files = explode(',', $opt->getOption('files'));
     }
     if ($opt->getOption('verbose')) {
         $this->verbose = Log::ERROR | Log::DEBUG;
     }
 }
Example #18
0
 public function parseCommandLine()
 {
     try {
         $opts = new Zend_Console_Getopt(array('development|d' => 'development mode', 'verbose|v' => 'verbose output', 'json|j' => 'JSON output'));
         $opts->parse();
     } catch (Zend_Console_Getopt_Exception $e) {
         echo $e->getUsageMessage();
         exit;
     }
     if ($opts->getOption('d')) {
         $this->_environment = 'development';
     }
     $args = $opts->getRemainingArgs();
     if (count($args) < 1) {
         $args = array('help');
     }
     $this->_controller = array_shift($args);
     if (count($args) < 1) {
         $args = array('help');
     }
     $this->_action = array_shift($args);
     $this->_arguments = $args;
     return $this;
 }
// Initialize the application path and autoloading
defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../core/application'));
set_include_path(implode(PATH_SEPARATOR, array(APPLICATION_PATH . '/../library', get_include_path())));
require_once 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance();
// Define some CLI options
$getopt = new Zend_Console_Getopt(array('withbuffer|b' => 'Load database with buffer data', 'withdata|w' => 'Load database with sample data', 'withdevs|d' => 'Load database with dev settings', 'env|e-s' => 'Application environment for which to create database (defaults to development)', 'help|h' => 'Help -- usage message'));
try {
    $getopt->parse();
} catch (Zend_Console_Getopt_Exception $e) {
    // Bad options passed: report usage
    echo $e->getUsageMessage();
    return false;
}
// If help requested, report usage message
if ($getopt->getOption('h')) {
    echo $getopt->getUsageMessage();
    return true;
}
// Initialize values based on presence or absence of CLI options
$withData = $getopt->getOption('w');
$withBuffer = $getopt->getOption('b');
$withDevs = $getopt->getOption('d');
$env = $getopt->getOption('e');
defined('APPLICATION_ENV') || define('APPLICATION_ENV', null === $env ? 'development' : $env);
// Initialize Zend_Application
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
// Initialize and retrieve DB resource
$bootstrap = $application->getBootstrap();
$bootstrap->bootstrap('db');
$dbAdapter = $bootstrap->getResource('db');
defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../core/application'));
set_include_path(implode(PATH_SEPARATOR, array(APPLICATION_PATH . '/../library', get_include_path())));
require_once 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance()->registerNamespace('X_');
require_once 'pclzip.php';
// Define some CLI options
$getopt = new Zend_Console_Getopt(array('class|c-s' => 'Set permission class required by resources', 'store|s-s' => 'Store to file', 'append|a-s' => 'Append to file (-l required)', 'limit|l-s' => 'Limit check to a single class only', 'help|h' => 'Help -- usage message'));
try {
    $getopt->parse();
} catch (Zend_Console_Getopt_Exception $e) {
    // Bad options passed: report usage
    echo $e->getUsageMessage();
    return false;
}
// Initialize values based on presence or absence of CLI options
$defClass = $getopt->getOption('c');
$file = $getopt->getOption('s');
$append = $getopt->getOption('a');
$limit = $getopt->getOption('l');
// If help requested, report usage message
if (!$defClass || $getopt->getOption('h')) {
    echo $getopt->getUsageMessage();
    return true;
}
$buffer = '';
$template = <<<TMPL

INSERT INTO plg_acl_resources
\t("key", "class", "generator") VALUES
\t('default/%s/%s', '%s', '');
Example #21
0
/**
 * Do general setup for a CLI script
 * @param array $pa_additional_parameters Additional command line parameters. You don't have to add
 * --log/-l for the log file and --log-level/-d for the Zend_Log log level. They're always set up automatically
 * @return Zend_Console_Getopt
 */
function caSetupCLIScript($pa_additional_parameters)
{
    require_once __CA_LIB_DIR__ . "/core/Zend/Console/Getopt.php";
    require_once __CA_LIB_DIR__ . "/core/Zend/Log.php";
    require_once __CA_LIB_DIR__ . "/core/Zend/Log/Writer/Stream.php";
    require_once __CA_LIB_DIR__ . "/core/Zend/Log/Writer/Syslog.php";
    require_once __CA_LIB_DIR__ . "/core/Zend/Log/Formatter/Simple.php";
    $va_available_cli_opts = array_merge(array("log|l-s" => "Path to log file. If omitted, we log into the system log. Note that we don't log DEBUG messages into the system log, even when the log level is set to DEBUG.", "log-level|d-s" => "Log level"), $pa_additional_parameters);
    try {
        $o_opts = new Zend_Console_Getopt($va_available_cli_opts);
        $o_opts->parse();
    } catch (Exception $e) {
        die("Invalid command line options: " . $e->getMessage() . PHP_EOL);
    }
    // set up logging
    $o_writer = null;
    if ($vs_log = $o_opts->getOption('log')) {
        // log to file
        try {
            $o_writer = new Zend_Log_Writer_Stream($vs_log);
            $o_writer->setFormatter(new Zend_Log_Formatter_Simple('%timestamp% %priorityName%: %message%' . PHP_EOL));
        } catch (Zend_Log_Exception $e) {
            // error while opening the file (usually permissions)
            $o_writer = null;
            print CLIUtils::textWithColor("Couldn't open log file. Now logging via system log.", "bold_red") . PHP_EOL . PHP_EOL;
        }
    }
    // default: log everything to syslog
    if (!$o_writer) {
        $o_writer = new Zend_Log_Writer_Syslog(array('application' => 'CollectiveAccess CLI', 'facility' => LOG_USER));
        // no need for timespamps in syslog ... the syslog itsself provides that
        $o_writer->setFormatter(new Zend_Log_Formatter_Simple('%priorityName%: %message%' . PHP_EOL));
    }
    // was a loglevel set via command line? -> add filter to Zend logger, otherwise use WARN
    $vs_level = $o_opts->getOption('log-level');
    switch ($vs_level) {
        case 'ERR':
            $o_filter = new Zend_Log_Filter_Priority(Zend_Log::ERR);
            break;
        case 'DEBUG':
            $o_filter = new Zend_Log_Filter_Priority(Zend_Log::DEBUG);
            break;
        case 'INFO':
            $o_filter = new Zend_Log_Filter_Priority(Zend_Log::INFO);
            break;
        case 'WARN':
        default:
            $o_filter = new Zend_Log_Filter_Priority(Zend_Log::WARN);
            break;
    }
    // set up global logger. can be used by importing 'global $g_logger' anywhere, but it's recommended to use the caCLILog() helper instead
    global $g_logger;
    $g_logger = new Zend_Log($o_writer);
    $g_logger->setTimestampFormat('D Y-m-d H:i:s');
    $g_logger->addFilter($o_filter);
    return $o_opts;
}
Example #22
0
<?php

/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
require_once __DIR__ . '/bootstrap.php';
use Magento\Framework\Test\Utility\Files;
use Magento\Tools\Dependency\ServiceLocator;
try {
    $console = new \Zend_Console_Getopt(['directory|d=s' => 'Path to base directory for parsing']);
    $console->parse();
    $directory = $console->getOption('directory') ?: BP;
    Files::setInstance(new \Magento\Framework\Test\Utility\Files($directory));
    $filesForParse = Files::init()->getComposerFiles('code', false);
    ServiceLocator::getCircularDependenciesReportBuilder()->build(['parse' => ['files_for_parse' => $filesForParse], 'write' => ['report_filename' => 'modules-circular-dependencies.csv']]);
    fwrite(STDOUT, PHP_EOL . 'Report successfully processed.' . PHP_EOL);
} catch (\Zend_Console_Getopt_Exception $e) {
    fwrite(STDERR, $e->getUsageMessage() . PHP_EOL);
    exit(1);
} catch (\Exception $e) {
    fwrite(STDERR, 'Please, check passed path. Dependencies report generator failed: ' . $e->getMessage() . PHP_EOL);
    exit(1);
}
 * @license    http://www.pimcore.org/license     New BSD License
 */
chdir(__DIR__);
include "startup.php";
try {
    $opts = new \Zend_Console_Getopt(array('core|c' => 'generate class map for all core files in /pimcore (usually used by the core team)', 'website|w' => 'generate class map for all classes in include path (usually for you ;-) ) - this is the default', 'help|h' => 'display this help'));
} catch (Exception $e) {
    echo $e->getMessage();
}
try {
    $opts->parse();
} catch (\Zend_Console_Getopt_Exception $e) {
    echo $e->getMessage();
}
// display help message
if ($opts->getOption("help")) {
    echo $opts->getUsageMessage();
    exit;
}
$excludePatterns = [];
if ($opts->getOption("core")) {
    $paths = array(PIMCORE_PATH . "/lib", PIMCORE_PATH . "/models");
    $output = PIMCORE_PATH . "/config/autoload-classmap.php";
    $excludePatterns = ["/^Google_/", "/^Zend_Service/", "/^Zend_Gdata/", "/^Zend_Pdf/", "/^Zend_Tool/", "/^Zend_CodeGenerator/", "/^Zend_Ldap/", "/^Zend_Amf/", "/^Zend_Dojo/", "/^Zend_Wildfire/", "/^Zend_Soap/", "/^Zend_XmlRpc/", "/^Zend_Reflection/", "/^Zend_Cloud/", "/^Zend_Mobile/", "/^Zend_Feed/", "/^Zend_Test/", "/^Zend_Barcode/", "/^Zend_Search/", "/^Zend_Queue/", "/^Zend_Oauth/", "/^Zend_Application/", "/^Zend_Measure/", "/^Zend_OpenId/", "/^Hybrid/", "/^lessc/", "/^Csv/"];
} else {
    $paths = explode(PATH_SEPARATOR, get_include_path());
    $output = PIMCORE_CONFIGURATION_DIRECTORY . "/autoload-classmap.php";
}
$globalMap = array();
$map = new stdClass();
foreach ($paths as $path) {
Example #24
0
<?php

require_once 'Ecl/Loader.php';
Ecl_Loader::registerAutoload();
define('GOOGLE_API_URL', 'https://www.googleapis.com/language/translate/v2');
define('GOOGLE_API_KEY', 'AIzaSyDv2ag1h8hSTMC8ZJDv7C5yLYEAf-figr0');
$opts = new Zend_Console_Getopt(array('source|s=s' => 'Source Language (defaults to english)', 'dest|d=s' => 'destination language'));
try {
    $opts->parse();
    if (!$opts->getOption('d')) {
        throw new Zend_Console_Getopt_Exception('Unknown Destination Language');
    }
} catch (Zend_Console_Getopt_Exception $e) {
    print <<<END
Usage:
     php translate.php [--source|-s <string>] --dest|d <string>

Valid Options:
     --source|-s <string>
          Source language (defaults to english)
     --dest|-d <string>
          Destination language

Examples:
     cat Base.js | php translate.php -l es > es-ES/Base.js
     php translate.php --lang ja < Base.js > ja-JP/Base.js

Languages:
af     Afrikaans           gl Galician       fa Persian
sq     Albanian            de German         pl Polish
ar     Arabic              el Greek          pt Portuguese
Example #25
0
 * @copyright  Copyright (c) 2009-2010 elements.at New Media Solutions GmbH (http://www.elements.at)
 * @license    http://www.pimcore.org/license     New BSD License
 */
include_once "startup.php";
try {
    $opts = new Zend_Console_Getopt(array('job|j=s' => 'call just a specific job(s), use "," (comma) to execute more than one job (valid options: scheduledtasks, logmaintenance, sanitycheck, cleanupoldpidfiles, versioncleanup, redirectcleanup, cleanupbrokenviews, and plugin classes if you want to call a plugin maintenance)', 'manager|m=s' => 'force a specific manager (valid options: procedural, daemon)', 'ignore-maintenance-mode' => 'forces the script execution even when the maintenance mode is activated', 'verbose|v' => 'show detailed information during the maintenance (for debug, ...)', 'help|h' => 'display this help'));
} catch (Exception $e) {
    echo $e->getMessage();
}
try {
    $opts->parse();
} catch (Zend_Console_Getopt_Exception $e) {
    echo $e->getMessage();
}
// display help message
if ($opts->getOption("help")) {
    echo $opts->getUsageMessage();
    exit;
}
if ($opts->getOption("verbose")) {
    $writer = new Zend_Log_Writer_Stream('php://output');
    $logger = new Zend_Log($writer);
    Logger::addLogger($logger);
    // set all priorities
    Logger::setPriorities(array(Zend_Log::DEBUG, Zend_Log::INFO, Zend_Log::NOTICE, Zend_Log::WARN, Zend_Log::ERR, Zend_Log::CRIT, Zend_Log::ALERT, Zend_Log::EMERG));
}
$forceType = null;
if ($opts->getOption("manager")) {
    $forceType = $opts->getOption("manager");
}
$validJobs = array();
Example #26
0
use Magento\Framework\ObjectManager\Code\Generator\Factory;
use Magento\Framework\ObjectManager\Code\Generator\Proxy;
use Magento\Framework\ObjectManager\Code\Generator\Repository;
use Magento\Framework\ObjectManager\Code\Generator\Persistor;
use Magento\Framework\Api\Code\Generator\ExtensionAttributesGenerator;
use Magento\Framework\Api\Code\Generator\ExtensionAttributesInterfaceGenerator;
use Magento\Tools\Di\Code\Scanner;
use Magento\Tools\Di\Compiler\Log\Log;
use Magento\Tools\Di\Compiler\Log\Writer;
use Magento\Tools\Di\Definition\Compressor;
use Magento\Tools\Di\Definition\Serializer\Igbinary;
use Magento\Tools\Di\Definition\Serializer\Standard;
try {
    $opt = new Zend_Console_Getopt(['serializer=w' => 'serializer function that should be used (serialize|igbinary) default: serialize', 'verbose|v' => 'output report after tool run', 'extra-classes-file=s' => 'path to file with extra proxies and factories to generate', 'generation=s' => 'absolute path to generated classes, <magento_root>/var/generation by default', 'di=s' => 'absolute path to DI definitions directory, <magento_root>/var/di by default', 'exclude-pattern=s' => 'allows to exclude Paths from compilation (default is #[\\\\/]m1[\\\\/]#i)']);
    $opt->parse();
    $generationDir = $opt->getOption('generation') ? $opt->getOption('generation') : $rootDir . '/var/generation';
    $diDir = $opt->getOption('di') ? $opt->getOption('di') : $rootDir . '/var/di';
    $testExcludePatterns = ["#^{$rootDir}/app/code/[\\w]+/[\\w]+/Test#", "#^{$rootDir}/lib/internal/[\\w]+/[\\w]+/([\\w]+/)?Test#", "#^{$rootDir}/setup/src/Magento/Setup/Test#", "#^{$rootDir}/dev/tools/Magento/Tools/[\\w]+/Test#"];
    $fileExcludePatterns = $opt->getOption('exclude-pattern') ? [$opt->getOption('exclude-pattern')] : ['#[\\\\/]M1[\\\\/]#i'];
    $fileExcludePatterns = array_merge($fileExcludePatterns, $testExcludePatterns);
    $relationsFile = $diDir . '/relations.ser';
    $pluginDefFile = $diDir . '/plugins.ser';
    $compilationDirs = [$rootDir . '/app/code', $rootDir . '/lib/internal/Magento', $rootDir . '/dev/tools/Magento/Tools'];
    /** @var Writer\WriterInterface $logWriter Writer model for success messages */
    $logWriter = $opt->getOption('v') ? new Writer\Console() : new Writer\Quiet();
    $log = new Log($logWriter, new Writer\Console());
    $serializer = $opt->getOption('serializer') == Igbinary::NAME ? new Igbinary() : new Standard();
    AutoloaderRegistry::getAutoloader()->addPsr4('Magento\\', $generationDir . '/Magento/');
    // 1 Code generation
    // 1.1 Code scan
    $filePatterns = ['php' => '/.*\\.php$/', 'di' => '/\\/etc\\/([a-zA-Z_]*\\/di|di)\\.xml$/'];
/**
 * This function will look at the given program arguments and will validate them.
 * If the required arguments have been passed then it will call the template detector function,
 * otherwise it will stop the program.
 * This function is called at the end of this script (see last line of this file).
 * The help text below describes the arguments that are needed.
 */
function parseArgs()
{
    $rules = array('sourceDir|d=s' => 'Required. The base directory that the project resides in', 'detectorDbFileName|i=s' => 'Required. SQLite file that contains the call stack to examine. This file is created by ' . 'Triumph; Triumph performs INSERTs as it generates a call stack.', 'outputDbFileName|o-s' => 'Optional. If given, the output will be written to the given file. If not given, output goes to STDOUT.', 'help|h' => 'This help message');
    $opts = new Zend_Console_Getopt($rules);
    // trim any quotes
    $sourceDir = trim($opts->getOption('sourceDir'), " \r\n\t'\"");
    $detectorDbFileName = trim($opts->getOption('detectorDbFileName'), " \r\n\t'\"");
    $outputDbFileName = trim($opts->getOption('outputDbFileName'), " \r\n\t'\"");
    $help = trim($opts->getOption('help'), " \r\n\t'\"");
    if ($help) {
        $helpMessage = <<<EOF
The goal of this script is to discover template files for your PHP Laravel projects. This means
that given a triumph call stack, this script will list all of the template files that are used by the 
given controller functions. This script will be called via a command line; it is a normal command line script.

This script is part of Triumph's Template Files Detection feature; it enables the editor to have a 
list of all of a project's template files so that the user can easily open / jump to templates. More
info can be about Triumph's template file detector feature can be found at 
http://docs.triumph4php.com/template-file-detectors/

When a required argument is invalid or missing, the program will exit with an error code (-1)

EOF;
        echo $helpMessage;
        echo "\n";
        echo $opts->getUsageMessage();
        exit(-1);
    }
    if (!$sourceDir) {
        echo "Missing argument: --sourceDir. See --help for details.\n";
        exit(-1);
    }
    if (!is_dir($sourceDir)) {
        echo "sourceDir is not a valid directory. Is \"{$sourceDir}\" a directory? Is it readable? \n";
        exit(-1);
    }
    if (!$detectorDbFileName) {
        echo "Missing argument: --detectorDbFileName. See --help for details.\n";
        exit(-1);
    }
    if (!extension_loaded('pdo_sqlite') || !extension_loaded('PDO')) {
        echo "The script " . basename(__FILE__) . " requires the PDO and pdo_sqlite PHP extensions.";
        exit(-1);
    }
    // call the function that will return all detected templates
    $doSkip = TRUE;
    $arrTemplates = detectTemplates($sourceDir, $detectorDbFileName, $doSkip);
    if ($doSkip) {
        echo "Detector " . basename(__FILE__, '.php') . " cannot detect template files for {$sourceDir} ... skipping\n";
    } else {
        if ($outputDbFileName) {
            // now send the detected templates to either STDOUT or store in the
            // sqlite DB
            $pdo = Zend_Db::factory('Pdo_Sqlite', array("dbname" => $outputDbFileName));
            $templateFileTable = new Triumph_TemplateFileTagTable($pdo);
            $templateFileTable->saveTemplateFiles($arrTemplates, $sourceDir);
            echo "Template file detection complete, written to {$outputDbFileName}\n";
        } else {
            if (!empty($arrTemplates)) {
                echo str_pad("Template File", 60) . str_pad("Variables", 90) . "\n";
                foreach ($arrTemplates as $template) {
                    echo str_pad($template->fullPath, 60);
                    echo str_pad(join(',', $template->variables), 90);
                    echo "\n";
                }
            } else {
                echo "No template files were detected for {$sourceDir}\n";
            }
        }
    }
}
Example #28
0
 */
chdir(__DIR__);
include_once "startup.php";
use Pimcore\Model\Asset;
try {
    $opts = new \Zend_Console_Getopt(array('verbose|v' => 'show detailed information (for debug, ...)', 'help|h' => 'display this help', "parent|p=i" => "only create thumbnails of images in this folder (ID)", "thumbnails|t=s" => "only create specified thumbnails (comma separated eg.: thumb1,thumb2)", "system|s" => "create system thumbnails (used for tree-preview, ...)", "force|f" => "recreate thumbnails, regardless if they exist already"));
} catch (Exception $e) {
    echo $e->getMessage();
}
try {
    $opts->parse();
} catch (\Zend_Console_Getopt_Exception $e) {
    echo $e->getMessage();
}
// display help message
if ($opts->getOption("help")) {
    echo $opts->getUsageMessage();
    exit;
}
if ($opts->getOption("verbose")) {
    $logger = new \Monolog\Logger('core');
    $logger->pushHandler(new \Monolog\Handler\StreamHandler('php://stdout'));
    \Logger::addLogger($logger);
    // set all priorities
    \Logger::setVerbosePriorities();
}
// get all thumbnails
$dir = Asset\Image\Thumbnail\Config::getWorkingDir();
$thumbnails = array();
$files = scandir($dir);
foreach ($files as $file) {
/**
 * This function will look at the given program arguments and will validate them.
 * If the required arguments have been passed then it will call the Tag detector function,
 * otherwise it will stop the program.
 * This function is called at the end of this script (see last line of this file).
 * The help text below describes the arguments that are needed.
 */
function parseArgs()
{
    $rules = array('sourceDir|d=s' => 'Required. The base directory that the project resides in', 'resourceDbFileName|i=s' => 'Required. SQLite file that contains the project\'s files, classes, and methods. This file is created by ' . 'Triumph; Triumph performs INSERTs as it indexes a project.', 'outputDbFileName|o-s' => 'Optional. If given, the output will be written to the given file. If not given, output goes to STDOUT.', 'help|h' => 'This help message');
    $opts = new Zend_Console_Getopt($rules);
    // trim any quotes
    $sourceDir = trim($opts->getOption('sourceDir'), " \r\n\t'\"");
    $resourceDbFileName = trim($opts->getOption('resourceDbFileName'), " \r\n\t'\"");
    $outputDbFileName = trim($opts->getOption('outputDbFileName'), " \r\n\t'\"");
    $help = trim($opts->getOption('help'), " \r\n\t'\"");
    if ($help) {
        $helpMessage = <<<EOF
The goal of this script is to discover all of the 'dynamic' tags for any PHP projects that use the
CodeIgniter framework. In a nutshell, Triumph cannot provide Code completion for calling the
core CodeIgniter classes within a controller (ie "{$this->input}" will not trigger code completion").
This script will add he CI core objects and libraries to the Triumph tag cache so that 
Triumph can know about them during code completion. It will also
detect any user-created libraries as well. This script.
will be called via a command line; it is a normal command line script.

This script is part of Triumph's Tag Detection feature; it enables the editor to have a 
more useful list when performing code completion. More
info can be about Triumph's Tag detector feature can be found at 
http://docs.triumph4php.com/tag-detectors/

When a required argument is invalid or missing, the program will exit with an error code (-1)

EOF;
        echo $helpMessage;
        echo "\n";
        echo $opts->getUsageMessage();
        exit(-1);
    }
    if (!$sourceDir) {
        echo "Missing argument: --sourceDir. See --help for details.\n";
        exit(-1);
    }
    if (!is_dir($sourceDir)) {
        echo "sourceDir is not a valid directory. Is \"{$sourceDir}\" a directory? Is it readable? \n";
        exit(-1);
    }
    if (!$resourceDbFileName) {
        echo "Missing argument: --resourceDbFileName. See --help for details.\n";
        exit(-1);
    }
    if (!extension_loaded('pdo_sqlite') || !extension_loaded('PDO')) {
        echo "The script " . basename(__FILE__) . " requires the PDO and pdo_sqlite PHP extensions.";
        exit(-1);
    }
    // call the function that will return all detected URLs
    $doSkip = TRUE;
    $arrTags = detectTags($sourceDir, $resourceDbFileName, $doSkip);
    if ($doSkip) {
        echo "Detector " . basename(__FILE__, '.php') . " cannot detect tags for  {$sourceDir} ... skipping\n";
    } else {
        if ($outputDbFileName) {
            // now send the detected URLs to either STDOUT or store in the
            // sqlite DB
            $pdo = Zend_Db::factory('Pdo_Sqlite', array("dbname" => $outputDbFileName));
            $resourceTable = new Triumph_DetectedTagTable($pdo);
            $resourceTable->saveTags($arrTags, $sourceDir);
            echo "Tag detection complete, written to {$outputDbFileName}\n";
        } else {
            if (!empty($arrTags)) {
                echo str_pad("Type", 10) . str_pad("Class", 25) . str_pad("Member", 25) . str_pad("Return Type", 20) . "\n";
                foreach ($arrTags as $tag) {
                    echo str_pad(Triumph_DetectedTag::typeString($tag->type), 10);
                    echo str_pad($tag->className, 25);
                    echo str_pad($tag->identifier, 25);
                    echo str_pad($tag->returnType, 25);
                    echo "\n";
                }
            } else {
                echo "No tags were detected for {$sourceDir}\n";
            }
        }
    }
}
Example #30
0
 public function parse()
 {
     $endpointRequest = $this->_endpoint->getRequest();
     if ($this->_workingArguments[0] == $_SERVER["SCRIPT_NAME"]) {
         array_shift($this->_workingArguments);
     }
     if (!$this->_parseGlobalPart() || count($this->_workingArguments) == 0) {
         // @todo process global options?
         return;
     }
     $actionName = array_shift($this->_workingArguments);
     // is the action name valid?
     $cliActionNameMetadatas = Zend_Tool_Rpc_Manifest_Registry::getInstance()->getMetadatas(array('type' => 'Action', 'name' => 'cliActionName'));
     foreach ($cliActionNameMetadatas as $cliActionNameMetadata) {
         if ($actionName == $cliActionNameMetadata->getValue()) {
             $action = $cliActionNameMetadata->getReference();
             break;
         }
     }
     $endpointRequest->setActionName($action->getName());
     /* @TODO Action Parameter Requirements */
     if (count($this->_workingArguments) == 0) {
         return;
     }
     if (!$this->_parseActionPart() || count($this->_workingArguments) == 0) {
         return;
     }
     $cliProviderName = array_shift($this->_workingArguments);
     $cliSpecialtyName = '_global';
     if (strstr($cliProviderName, '.')) {
         list($cliProviderName, $cliSpecialtyName) = explode('.', $cliProviderName);
     }
     $cliProviderNameMetadatas = Zend_Tool_Rpc_Manifest_Registry::getInstance()->getMetadatas(array('type' => 'Provider', 'name' => 'cliProviderName'));
     foreach ($cliProviderNameMetadatas as $cliProviderNameMetadata) {
         if ($cliProviderName == $cliProviderNameMetadata->getValue()) {
             $provider = $cliProviderNameMetadata->getReference();
             break;
         }
     }
     $endpointRequest->setProviderName($provider->getName());
     $cliSpecialtyNameMetadatas = Zend_Tool_Rpc_Manifest_Registry::getInstance()->getMetadatas(array('type' => 'Provider', 'providerName' => $provider->getName(), 'name' => 'cliSpecialtyNames'));
     foreach ($cliSpecialtyNameMetadatas as $cliSpecialtyNameMetadata) {
         if ($cliSpecialtyName == $cliSpecialtyNameMetadata->getValue()) {
             $specialtyName = $cliSpecialtyNameMetadata->getSpecialtyName();
             break;
         }
     }
     $endpointRequest->setSpecialtyName($specialtyName);
     $cliActionableMethodLongParameterMetadata = Zend_Tool_Rpc_Manifest_Registry::getInstance()->getMetadata(array('type' => 'Provider', 'providerName' => $provider->getName(), 'actionName' => $action->getName(), 'specialtyName' => $specialtyName, 'name' => 'cliActionableMethodLongParameters'));
     $cliActionableMethodShortParameterMetadata = Zend_Tool_Rpc_Manifest_Registry::getInstance()->getMetadata(array('type' => 'Provider', 'providerName' => $provider->getName(), 'actionName' => $action->getName(), 'specialtyName' => $specialtyName, 'name' => 'cliActionableMethodShortParameters'));
     $cliParameterNameShortValues = $cliActionableMethodShortParameterMetadata->getValue();
     $getoptOptions = array();
     foreach ($cliActionableMethodLongParameterMetadata->getValue() as $parameterNameLong => $cliParameterNameLong) {
         $optionConfig = $cliParameterNameLong . '|';
         $cliActionableMethodReferenceData = $cliActionableMethodLongParameterMetadata->getReference();
         if ($cliActionableMethodReferenceData['type'] == 'string' || $cliActionableMethodReferenceData['type'] == 'bool') {
             $optionConfig .= $cliParameterNameShortValues[$parameterNameLong] . ($cliActionableMethodReferenceData['optional'] ? '-' : '=') . 's';
         } elseif (in_array($cliActionableMethodReferenceData['type'], array('int', 'integer', 'float'))) {
             $optionConfig .= $cliParameterNameShortValues[$parameterNameLong] . ($cliActionableMethodReferenceData['optional'] ? '-' : '=') . 'i';
         } else {
             $optionConfig .= $cliParameterNameShortValues[$parameterNameLong] . '-s';
         }
         $getoptOptions[$optionConfig] = $cliActionableMethodReferenceData['description'] != '' ? $cliActionableMethodReferenceData['description'] : 'No description available.';
     }
     $getoptParser = new Zend_Console_Getopt($getoptOptions, $this->_workingArguments, array('parseAll' => false));
     $getoptParser->parse();
     foreach ($getoptParser->getOptions() as $option) {
         $value = $getoptParser->getOption($option);
         $endpointRequest->setProviderParameter($option, $value);
     }
     /*
     Zend_Debug::dump($getoptParser); 
     Zend_Debug::dump($endpointRequest);
     die();
     */
     $this->_workingArguments = $getoptParser->getRemainingArgs();
     return;
 }