本文整理汇总了PHP中Console_CommandLine::fromXmlFile方法的典型用法代码示例。如果您正苦于以下问题:PHP Console_CommandLine::fromXmlFile方法的具体用法?PHP Console_CommandLine::fromXmlFile怎么用?PHP Console_CommandLine::fromXmlFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Console_CommandLine
的用法示例。
在下文中一共展示了Console_CommandLine::fromXmlFile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$this->concentrator = new Concentrate_Concentrator();
$this->parser = Console_CommandLine::fromXmlFile($this->getUiXml());
try {
$result = $this->parser->parse();
$this->setOptions($result->options);
$this->setWebRoot($result->args['webroot']);
$this->loadDataFiles();
if ($this->combine) {
$this->writeCombinedFiles();
$this->writeCombinedFlagFile();
}
if ($this->compile) {
$this->writeCompiledFiles();
$this->writeCompiledFlagFile();
}
if ($this->minify) {
$this->writeMinifiedFiles();
$this->writeMinifiedFlagFile();
}
} catch (Console_CommandLine_Exception $e) {
$this->displayError($e->getMessage() . PHP_EOL);
} catch (Exception $e) {
$this->displayError($e->getMessage() . PHP_EOL, false);
$this->displayError($e->getTraceAsString() . PHP_EOL);
}
}
示例2: getCommandLineParser
/**
* Gets the CLI parser for this pinentry
*
* @return Console_CommandLine the CLI parser for this pinentry.
*/
protected function getCommandLineParser()
{
return Console_CommandLine::fromXmlFile($this->getUIXML());
}
示例3: dirname
* http://opensource.org/licenses/mit-license.php
*
* @category Console
* @package Console_CommandLine
* @author David JEAN LOUIS <izimobil@gmail.com>
* @copyright 2007 David JEAN LOUIS
* @license http://opensource.org/licenses/mit-license.php MIT License
* @version CVS: $Id$
* @link http://pear.php.net/package/Console_CommandLine
* @since File available since release 0.1.0
*/
// Include the Console_CommandLine package.
require_once 'Console/CommandLine.php';
// create the parser
$xmlfile = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'ex4.xml';
$parser = Console_CommandLine::fromXmlFile($xmlfile);
// run the parser
try {
$result = $parser->parse();
if ($result->command_name) {
$st = $result->command->options['reverse'] ? strrev($result->command->args['text']) : $result->command->args['text'];
if ($result->command_name == 'foo') {
echo "Foo says: {$st}\n";
} else {
if ($result->command_name == 'bar') {
echo "Bar says: {$st}\n";
}
}
}
} catch (Exception $exc) {
$parser->displayError($exc->getMessage());