当前位置: 首页>>代码示例>>PHP>>正文


PHP ezcConsoleOutput类代码示例

本文整理汇总了PHP中ezcConsoleOutput的典型用法代码示例。如果您正苦于以下问题:PHP ezcConsoleOutput类的具体用法?PHP ezcConsoleOutput怎么用?PHP ezcConsoleOutput使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ezcConsoleOutput类的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();
     }
 }
开发者ID:jmfontaine,项目名称:PHP_ConfigReport,代码行数:59,代码来源:Text.php

示例2: renderTable

 /**
  * Generate table output
  *
  * @param VcsStats_Table $table Table
  * @return void
  */
 public function renderTable(VcsStats_Report_Element_Table $table)
 {
     $result = '';
     $output = new ezcConsoleOutput();
     $output->formats->title->style = array('bold');
     $alignments = array('center' => ezcConsoleTable::ALIGN_CENTER, 'left' => ezcConsoleTable::ALIGN_LEFT, 'right' => ezcConsoleTable::ALIGN_RIGHT);
     $consoleTable = new ezcConsoleTable($output, 78);
     // Display header
     $consoleTable[0]->align = ezcConsoleTable::ALIGN_CENTER;
     foreach ($table->getColumns() as $column) {
         $consoleTable[0][]->content = $column->getTitle();
     }
     // Display values
     foreach ($table->getRows() as $i => $row) {
         $j = 0;
         foreach ($row as $code => $value) {
             $alignment = $table->getColumn($code)->getAlignment();
             $consoleTable[$i + 1][$j]->align = $alignments[$alignment];
             $consoleTable[$i + 1][$j]->content = $value;
             $j++;
         }
     }
     ob_start();
     $output->outputLine();
     $output->outputLine($table->getTitle(), 'title');
     $consoleTable->outputTable();
     $output->outputLine();
     $output->outputLine();
     $result .= ob_get_clean();
     echo $result;
 }
开发者ID:jmfontaine,项目名称:vcsstats,代码行数:37,代码来源:Text.php

示例3: testProgressMonitor4

 public function testProgressMonitor4()
 {
     $out = new ezcConsoleOutput();
     $out->formats->tag->color = 'red';
     $out->formats->percent->color = 'blue';
     $out->formats->percent->style = array('bold');
     $out->formats->data->color = 'green';
     $status = new ezcConsoleProgressMonitor($out, 7, array('formatString' => $out->formatText('%2$10s', 'tag') . ' ' . $out->formatText('%1$6.2f%%', 'percent') . ' ' . $out->formatText('%3$s', 'data')));
     ob_start();
     for ($i = 0; $i < 7; $i++) {
         $status->addEntry($this->stati[$i][0], $this->stati[$i][1]);
     }
     $res = ob_get_contents();
     ob_end_clean();
     // To prepare test files use this:
     // file_put_contents( dirname( __FILE__ ) . '/data/' . ( ezcBaseFeatures::os() === "Windows" ? "windows/" : "posix/" ) . 'testProgressMonitor4.dat', $res );
     $this->assertEquals(file_get_contents(dirname(__FILE__) . '/data/' . (ezcBaseFeatures::os() === "Windows" ? "windows/" : "posix/") . 'testProgressMonitor4.dat'), $res, "Formated statusbar not generated correctly.");
 }
开发者ID:jacomyma,项目名称:GEXF-Atlas,代码行数:18,代码来源:progressmonitor_test.php

示例4: testRestorePosFailure

 public function testRestorePosFailure()
 {
     if (ezcBaseFeatures::os() === 'Windows') {
         $this->markTestSkipped("Does not work on Windows");
     }
     $output = new ezcConsoleOutput();
     try {
         $output->restorePos();
     } catch (ezcConsoleNoPositionStoredException $e) {
         return;
     }
     $this->fail("Exception not thrown on restore position without stored position.");
 }
开发者ID:naderman,项目名称:ezc-console-tools,代码行数:13,代码来源:output_test.php

示例5: __autoload

 * @package ConsoleTools
 * @version //autogen//
 * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
 */
require_once 'Base/src/base.php';
/**
 * Autoload ezc classes 
 * 
 * @param string $className 
 */
function __autoload($className)
{
    ezcBase::autoload($className);
}
// Create the output handler
$out = new ezcConsoleOutput();
// Set the verbosity to level 10
$out->options->verbosityLevel = 10;
// Enable auto wrapping of lines after 40 characters
$out->options->autobreak = 40;
// Set the color of the default output format to green
$out->formats->default->color = 'green';
// Set the color of the output format named 'success' to white
$out->formats->success->color = 'white';
// Set the style of the output format named 'success' to bold
$out->formats->success->style = array('bold');
// Set the color of the output format named 'failure' to red
$out->formats->failure->color = 'red';
// Set the style of the output format named 'failure' to bold
$out->formats->failure->style = array('bold');
// Set the background color of the output format named 'failure' to blue
开发者ID:sakshika,项目名称:ATM,代码行数:31,代码来源:example_output.php

示例6: testProgress9

 public function testProgress9()
 {
     $out = new ezcConsoleOutput();
     $formatString = '' . $out->formatText('Actual progress', 'success') . ': <' . $out->formatText('%bar%', 'failure') . '> ' . $out->formatText('%fraction%', 'success');
     $this->commonProgressbarTest(__FUNCTION__, 1073, 123, array('barChar' => '123', 'emptyChar' => '987', 'progressChar' => '---', 'width' => 97, 'formatString' => $formatString, 'fractionFormat' => '%o'));
 }
开发者ID:bmdevel,项目名称:ezc,代码行数:6,代码来源:progressbar_test.php

示例7: array

require 'autoload.php';

$cli = eZCLI::instance();
$script = eZScript::instance( array( 'description' => ( "Fixes eZImageAliasHandler bug (http://issues.ez.no/15155)" ),
                                     'use-session' => false,
                                     'use-modules' => true,
                                     'use-extensions' => true ) );

$script->startup();

$options = $script->getOptions( "[n]",
                                "",
                                array( 'n' => 'Do not wait the 10 safety seconds before starting' ) );
$script->initialize();

$output = new ezcConsoleOutput();
$output->formats->error->style = array( 'bold' );
$output->formats->error->color = 'red';

if ( !isset( $options['n'] ) )
{
    $output->outputLine( 'This script will delete images that look orphan' );
    $output->outputLine( 'Press ctrl-c in the next 10 seconds to prevent the script from starting...' );
    sleep( 10 );
}

try
{
    $output->outputLine( 'Looking for obsolete image files...' );

    // Fetch all image files in ezimagefile table
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:31,代码来源:fixorphanimages.php

示例8: __autoload

 * @package ConsoleTools
 * @version //autogen//
 * @copyright Copyright (C) 2005-2009 eZ Systems AS. All rights reserved.
 * @license http://ez.no/licenses/new_bsd New BSD License
 */
require_once 'Base/src/base.php';
/**
 * 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.
开发者ID:naderman,项目名称:pflow,代码行数:31,代码来源:example_progressmonitor.php

示例9: __set

 /**
  * Overloaded __set() method to gain read-only access to properties.
  * It also performs checks on setting others.
  *
  * @throws ezcBasePropertyNotFoundException
  *         If the setting you try to access does not exists
  * @throws ezcBaseValueException
  *         If trying to set an invalid value for a setting.
  * 
  * @param string $propertyName Name of the attrinbute to access.
  * @param string $val The value to set.
  * @ignore
  */
 public function __set($propertyName, $val)
 {
     if (!isset($this->properties[$propertyName])) {
         throw new ezcBasePropertyNotFoundException($propertyName);
     }
     // Extry handling of multi styles
     if ($propertyName === 'style') {
         if (!is_array($val)) {
             $val = array($val);
         }
         foreach ($val as $style) {
             if (!ezcConsoleOutput::isValidFormatCode($propertyName, $style)) {
                 throw new ezcBaseValueException($propertyName, $style, 'valid ezcConsoleOutput format code');
             }
         }
         $this->properties['style'] = $val;
         return;
     }
     // Continue normal handling
     if (($propertyName === "color" || $propertyName === "bgcolor") && !ezcConsoleOutput::isValidFormatCode($propertyName, $val)) {
         throw new ezcBaseValueException($propertyName, $val, 'valid ezcConsoleOutput format code');
     }
     $this->properties[$propertyName] = $val;
 }
开发者ID:sakshika,项目名称:ATM,代码行数:37,代码来源:output_format.php

示例10: dirname

<?php

/**
 * Analyses a FOF song and gets tracks & difficulties
 */
include dirname(__FILE__) . '/lib/autoload.php';
$input = new ezcConsoleInput();
$dryRunOption = $input->registerOption(new ezcConsoleOption('d', 'dry-run', ezcConsoleInput::TYPE_NONE, false));
$quietOption = $input->registerOption(new ezcConsoleOption('q', 'quiet', ezcConsoleInput::TYPE_NONE, false));
$helpOption = $input->registerOption(new ezcConsoleOption('h', 'help'));
$verboseOption = $input->registerOption(new ezcConsoleOption('v', 'verbose', ezcConsoleInput::TYPE_NONE, false));
$input->argumentDefinition = new ezcConsoleArguments();
$input->argumentDefinition[0] = new ezcConsoleArgument("artist");
$input->argumentDefinition[0]->mandatory = true;
$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"));
开发者ID:bdunogier,项目名称:fofscripts,代码行数:31,代码来源:linkbyartist.php

示例11: ezcConsoleOutput

<?php

require_once 'tutorial_autoload.php';
$output = new ezcConsoleOutput();
$output->formats->info->color = 'blue';
$output->outputText('Test text in color blue', 'info');
开发者ID:sakshika,项目名称:ATM,代码行数:6,代码来源:tutorial_example_01_output_basic.php

示例12: getFormatCode

 /**
  * Returns the code for a given formating option of a given type.
  *
  * $type is the type of formating ('color', 'bgcolor' or 'style'), $key the
  * name of the format to lookup. Returns the numeric code for the requested
  * format or 0 if format or type do not exist.
  * 
  * @see ezcConsoleOutput::isValidFormatCode()
  * 
  * @param string $type Formatting type.
  * @param string $key  Format option name.
  * @return int The code representation.
  */
 protected function getFormatCode($type, $key)
 {
     if (!ezcConsoleOutput::isValidFormatCode($type, $key)) {
         return 0;
     }
     return ezcConsoleOutput::${$type}[$key];
 }
开发者ID:sakshika,项目名称:ATM,代码行数:20,代码来源:output.php

示例13: 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');
开发者ID:sakshika,项目名称:ATM,代码行数:8,代码来源:tutorial_example_output_targets.php

示例14: 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);
 }
开发者ID:jacomyma,项目名称:GEXF-Atlas,代码行数:18,代码来源:generator.php

示例15: 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);
 }
开发者ID:bmdevel,项目名称:ezc,代码行数:18,代码来源:extractor.php


注:本文中的ezcConsoleOutput类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。