本文整理汇总了PHP中ezcConsoleOutput::outputLine方法的典型用法代码示例。如果您正苦于以下问题:PHP ezcConsoleOutput::outputLine方法的具体用法?PHP ezcConsoleOutput::outputLine怎么用?PHP ezcConsoleOutput::outputLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ezcConsoleOutput
的用法示例。
在下文中一共展示了ezcConsoleOutput::outputLine方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* Displays report or generates its files
*
* @param PHP_ConfigReport_Report $report Report
* @return void
*/
public function render(PHP_ConfigReport_Report $report)
{
$consoleOutput = new ezcConsoleOutput();
$consoleOutput->formats->extensionName->style = array('bold');
$consoleOutput->formats->columnTitle->style = array('bold');
$consoleOutput->formats->error->bgcolor = 'red';
$consoleOutput->formats->warning->bgcolor = 'yellow';
$consoleOutput->outputLine('PHP version: ' . $report->getPhpVersion());
$consoleOutput->outputLine('Environment: ' . $report->getEnvironment());
$noIssue = true;
foreach ($report->getSections() as $section) {
if ($section->hasIssues()) {
$noIssue = false;
$consoleOutput->outputLine();
$consoleOutput->outputLine($section->getExtensionName(), 'extensionName');
$table = new ezcConsoleTable($consoleOutput, $this->_width);
$table[0]->format = 'columnTitle';
$table[0][0]->content = 'Directive';
$table[0][1]->content = 'Level';
$table[0][2]->content = 'Type';
$table[0][3]->content = 'Value';
$table[0][4]->content = 'Suggested value';
$table[0][5]->content = 'Comments';
foreach ($section->getIssues() as $index => $issue) {
$table[$index + 1]->format = $issue->getLevel();
$directiveName = $issue->getDirectiveName();
if (is_array($directiveName)) {
$directiveName = implode(' / ', $directiveName);
}
$table[$index + 1][0]->content = $directiveName;
$table[$index + 1][1]->content = $issue->getLevel();
$table[$index + 1][2]->content = $issue->getType();
$directiveActualValue = $issue->getDirectiveActualValue();
if (is_array($directiveActualValue)) {
$directiveActualValue = implode(' / ', $directiveActualValue);
}
$table[$index + 1][3]->content = $directiveActualValue;
$directiveSuggestedValue = $issue->getDirectiveSuggestedValue();
if (is_array($directiveSuggestedValue)) {
$directiveSuggestedValue = implode(' / ', $directiveSuggestedValue);
}
$table[$index + 1][4]->content = $directiveSuggestedValue;
$table[$index + 1][5]->content = $issue->getComments();
}
$table->outputTable();
$consoleOutput->outputLine();
}
}
if ($noIssue) {
$consoleOutput->outputLine('No issue found.');
$consoleOutput->outputLine();
}
}
示例2: raiseError
/**
* Prints the message of an occured error and exits the program.
* This method is used to print an error message, as soon as an error
* occurs end quit the program with return code -1. Optionally, the
* method will trigger the help text to be printed after the error message.
*
* @param string $message The error message to print
* @param bool $printHelp Whether to print the help after the error msg.
*/
private function raiseError($message, $printHelp = false)
{
$this->output->outputLine($message, 'error');
$this->output->outputLine();
if ($printHelp === true) {
$this->output->outputText($this->input->getHelpText(self::PROGRAM_DESCRIPTION), "help");
}
exit(-1);
}
示例3: raiseError
/**
* Prints the message of an occured error and exits the program.
* This method is used to print an error message, as soon as an error
* occurs end quit the program with return code -1. Optionally, the
* method will trigger the help text to be printed after the error message.
*
* @param string $message The error message to print
* @param bool $printHelp Whether to print the help after the error msg.
*/
private function raiseError($message, $printHelp = false)
{
$this->output->outputLine($message, 'error');
$this->output->outputLine();
if ($printHelp === true) {
$this->output->outputText($this->input->getHelpText(ezcPersistentObjectSchemaGenerator::PROGRAM_DESCRIPTION), "help");
}
exit(-1);
}
示例4: ezcConsoleOutput
<?php
/**
* @package JetFuelCore
*/
require_once 'core/common.php';
$output = new ezcConsoleOutput();
$output->formats->info->color = 'blue';
// create a database schema from a database connection:
$db = ezcDbFactory::create(DB_DSN);
$dbSchema = ezcDbSchema::createFromDb($db);
// save a database schema to an XML file:
$dbSchema->writeToFile('xml', 'saved-schema.xml');
$messages = ezcDbSchemaValidator::validate($dbSchema);
foreach ($messages as $message) {
$output->outputLine($message, 'info');
}
$readerClass = ezcDbSchemaHandlerManager::getReaderByFormat('xml');
$reader = new $readerClass();
$schema = ezcDbSchema::createFromFile('xml', 'saved-schema.xml');
$writer = new ezcDbSchemaPersistentWriter(true, null);
$writer->saveToFile('app/model/definitions', $schema);
$output->outputLine("Class files successfully written to app/model/definitions.", 'info');
示例5: ezcConsoleOutput
<?php
require_once 'tutorial_autoload.php';
$output = new ezcConsoleOutput();
$output->formats->error->color = 'red';
$output->formats->error->style = array('bold');
$output->formats->error->target = ezcConsoleOutput::TARGET_STDERR;
$output->outputLine('Unable to connect to database', 'error');
示例6: addEntry
/**
* Print a status entry.
* Prints a new status entry to the console and updates the internal counter.
*
* @param string $tag The tag to print (second argument in the
* formatString).
* @param string $data The data to be printed in the status entry (third
* argument in the format string).
* @return void
*/
public function addEntry($tag, $data)
{
$this->counter++;
$percentage = $this->counter / $this->max * 100;
$this->outputHandler->outputLine(sprintf($this->options['formatString'], $percentage, $tag, $data));
}
示例7: displayVersion
/**
* Displays version informations
*
* @return void
*/
public static function displayVersion()
{
self::$consoleOutput->outputLine('vcsstats 0.1-dev by Jean-Marc Fontaine', 'version');
}
示例8: __autoload
/**
* Autoload ezc classes
*
* @param string $className
*/
function __autoload($className)
{
ezcBase::autoload($className);
}
$out = new ezcConsoleOutput();
// Create a progress monitor
$status = new ezcConsoleProgressMonitor($out, 7);
// Perform actions
$i = 0;
while ($i++ < 7) {
// Do whatever you want to indicate progress for
usleep(mt_rand(20000, 2000000));
// Advance the statusbar by one step
$status->addEntry('ACTION', "Performed action #{$i}.");
}
$out->outputLine();
/*
OUTPUT:
14.3% ACTION Performed action #1.
28.6% ACTION Performed action #2.
42.9% ACTION Performed action #3.
57.1% ACTION Performed action #4.
71.4% ACTION Performed action #5.
85.7% ACTION Performed action #6.
100.0% ACTION Performed action #7.
*/
示例9: ezcConsoleOutput
<?php
require_once 'tutorial_autoload.php';
$output = new ezcConsoleOutput();
$output->formats->info->color = 'blue';
$output->formats->error->color = 'red';
$output->formats->error->style = array('bold');
$output->formats->fatal->color = 'red';
$output->formats->fatal->style = array('bold', 'underlined');
$output->formats->fatal->bgcolor = 'black';
$output->outputText('This is some standard text ');
$output->outputText('including some error', 'error');
$output->outputText(' wrapped in standard text.');
$output->outputText("\n");
$output->outputLine('This is a fatal error message.', 'fatal');
$output->outputText('Test');
示例10: ezcConsoleOutput
$input->argumentDefinition[0]->shorthelp = "The artist to search for";
$output = new ezcConsoleOutput();
$output->formats->info->color = 'blue';
$output->formats->error->color = 'red';
$output->formats->error->style = array('bold');
$output->formats->fatal->color = 'red';
$output->formats->fatal->style = array('bold', 'underlined');
$output->formats->fatal->bgcolor = 'black';
try {
$input->process();
} catch (ezcConsoleArgumentMandatoryViolationException $e) {
if ($helpOption->value === true) {
$output->outputText($input->getHelpText("Auto-link by artist name"));
exit;
} else {
$output->outputLine("No arguments given", "fatal");
$output->outputText($input->getHelpText("Auto-link by artist name"));
exit(1);
}
} catch (ezcConsoleException $e) {
die($e->getMessage());
}
if ($input->argumentDefinition["artist"]->value === null) {
$output->outputLine("The <artist> argument is mandatory", 'fatal');
$output->outputText($input->getHelpText("Auto-link by artist name"), 'fatal');
exit;
}
var_dump($verboseOption->value);
$it = new FOFSongIterator('/home/xbmc/fof/songs/Packs');
$it->addFilter('artist', $input->argumentDefinition["artist"]->value);
foreach ($it as $song) {
示例11: ezcConsoleInput
}
$input = new ezcConsoleInput();
$output = new ezcConsoleOutput();
$helpOption = $input->registerOption(new ezcConsoleOption('h', 'help'));
$helpOption->isHelpOption = true;
$helpOption->shorthelp = 'Display current help information.';
$extensionOption = $input->registerOption(new ezcConsoleOption('e', 'extension', ezcConsoleInput::TYPE_STRING));
$extensionOption->mandatory = true;
$extensionOption->shorthelp = 'Full path to the eZ Publish extension e.g \'/home/ls/public_html/ezp/extension/myextension\'';
$extensionNameOption = $input->registerOption(new ezcConsoleOption('n', 'extension-name', ezcConsoleInput::TYPE_STRING));
$extensionNameOption->mandatory = true;
$extensionNameOption->shorthelp = 'Extension name. e.g \'myextension\'';
try {
$input->process();
} catch (ezcConsoleOptionException $e) {
$output->outputLine($e->getMessage());
exit;
}
if ($helpOption->value === true) {
$output->outputText($input->getHelpText('This script generate an XML definition for eZ Publish extension package type.'));
exit;
}
$sourceDir = $extensionOption->value;
$extensionName = $extensionNameOption->value;
$fileList = array();
recursiveList($sourceDir, '', $fileList);
$doc = new DOMDocument('1.0', 'utf-8');
$doc->formatOutput = true;
$packageRoot = $doc->createElement('extension');
$packageRoot->setAttribute('name', $extensionName);
foreach ($fileList as $file) {
示例12: ezcConsoleOutput
<?php
require_once 'tutorial_autoload.php';
$output = new ezcConsoleOutput();
$output->formats->info->color = 'blue';
$output->formats->info->style = array('bold');
$output->setOptions(array('autobreak' => 78, 'verbosityLevel' => 3));
$output->outputLine('This is a very very long info text. It has so much information in ' . 'it, that it will definitly not fit into 1 line. Therefore, ' . 'ezcConsoleOutput will automatically wrap the line for us.', 'info');
$output->outputLine();
$output->outputLine('This verbose information will currently not be displayed.', 'info', 10);
$output->outputLine('But this verbose information will be displayed.', 'info', 2);
示例13: ezcConsoleOutput
<?php
require_once 'tutorial_autoload.php';
$output = new ezcConsoleOutput();
$output->formats->success->color = 'green';
$output->formats->failure->color = 'red';
$options = array('successChar' => $output->formatText('+', 'success'), 'failureChar' => $output->formatText('-', 'failure'));
$status = new ezcConsoleStatusbar($output, $options);
for ($i = 0; $i < 120; $i++) {
$nextStatus = (bool) mt_rand(0, 1);
$status->add($nextStatus);
usleep(mt_rand(200, 2000));
}
$output->outputLine();
$output->outputLine('Successes: ' . $status->getSuccessCount() . ', Failures: ' . $status->getFailureCount());
示例14: ezcConsoleOption
$helpOpt->isHelpOption = true;
$helpOpt->shorthelp = 'Print help information.';
$helpOpt->longhelp = 'Display this help information about the program.';
$suiteOpt = $in->registerOption(new ezcConsoleOption('s', 'suite', ezcConsoleInput::TYPE_STRING, '*'));
$suiteOpt->shorthelp = 'Path pattern defining the client test suites to display data for.';
$suiteOpt->longhelp = 'This option may contain a path pattern as understood by glob(), defining the client test suites to display data for. An example would be "rfc" to only see the rfc tests or "r*" to see all suites starting with "r".';
$testOpt = $in->registerOption(new ezcConsoleOption('t', 'test', ezcConsoleInput::TYPE_STRING, '*'));
$testOpt->shorthelp = 'Path pattern defining the test cases to display data for.';
$testOpt->longhelp = 'This option may contain a path pattern as understood by glob(), defining the test cases to display data for. An example would be "get_*" to only see all test cases that start with "get_".';
$noColorOpt = $in->registerOption(new ezcConsoleOption('n', 'no-color'));
$noColorOpt->shorthelp = 'Switch of use of format codes (for logging).';
$noColorOpt->longhelp = 'Switches of the use of shell formatting codes, like color and style. This is particularly useful if you want to log the generated output.';
try {
$in->process();
} catch (ezcConsoleException $e) {
$out->outputLine($e->getMessage(), 'error');
$out->outputLine($in->getHelpText('Webdav client test viewer'), 'error');
exit(-1);
}
if ($helpOpt->value === true) {
$out->outputLine($in->getHelpText('Webdav client test viewer', 80, true));
exit(0);
}
if ($noColorOpt->value === true) {
$out->options->useFormats = false;
}
$suites = glob(dirname(__FILE__) . "/../clients/{$suiteOpt->value}", GLOB_ONLYDIR);
foreach ($suites as $suite) {
$tests = glob("{$suite}/{$testOpt->value}", GLOB_ONLYDIR);
foreach ($tests as $test) {
$requestInfos = loadFiles(glob("{$test}/request/*"));
示例15: ezcConsoleOutput
#!/usr/bin/php
<?php
include 'lib/autoload.php';
$out = new ezcConsoleOutput();
try {
$song = new FOFSong(getcwd());
} catch (Exception $e) {
echo "Exception: " . $e->getMessage() . "\n";
exit(1);
}
$out->outputLine($song->name . " by " . $song->artist);
$out->outputLine("Played count: {$song->count}");
$out->outputLine();
$out->outputLine("Scores: ");
foreach (array('easy', 'medium', 'hard', 'amazing') as $difficulty) {
if (isset($song->scores->{$difficulty})) {
$scores = $song->scores->{$difficulty};
$out->outputLine("* " . $scores->difficultyName);
foreach ($scores->scores as $idx => $score) {
$rank = $idx + 1;
$out->outputLine("{$rank}. {$score->player}: {$score->score} ({$score->stars}*, {$score->percentage}% - {$score->notesOk}/{$score->notesTotal})");
}
}
}