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


PHP ezcConsoleOutput::formatText方法代码示例

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


在下文中一共展示了ezcConsoleOutput::formatText方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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

示例2: generateRow

 /**
  * Generate a single physical row.
  * This method generates the string for a single physical table row.
  * 
  * @param array(int=>string) $cells Cells of the row.
  * @param array(int=>int) $colWidth Calculated columns widths.
  * @param ezcConsoleTableRow $row   The row to generate.
  * @return string The row.
  */
 private function generateRow($cells, $colWidth, $row)
 {
     $rowData = '';
     for ($cell = 0; $cell < count($colWidth); $cell++) {
         $align = $this->determineAlign($row, $cell);
         $format = $this->determineFormat($row, $cell);
         $borderFormat = $this->determineBorderFormat($row);
         $data = isset($cells[$cell]) ? $cells[$cell] : '';
         $rowData .= $this->outputHandler->formatText($this->properties['options']->lineHorizontal, $borderFormat);
         $rowData .= $this->properties['options']->colPadding;
         $rowData .= $this->outputHandler->formatText(str_pad($data, $colWidth[$cell], ' ', $align), $format);
         $rowData .= $this->properties['options']->colPadding;
     }
     $rowData .= $this->outputHandler->formatText($this->properties['options']->lineHorizontal, $row->borderFormat);
     return $rowData;
 }
开发者ID:jacomyma,项目名称:GEXF-Atlas,代码行数:25,代码来源:table.php

示例3: 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

示例4: __autoload

require_once 'Base/src/base.php';
/**
 * Autoload ezc classes 
 * 
 * @param string $className 
 */
function __autoload($className)
{
    ezcBase::autoload($className);
}
$out = new ezcConsoleOutput();
$out->formats->red->color = "red";
// Create progress bar itself
$progress = new ezcConsoleProgressbar($out, 100, array('step' => 5));
$progress->options->emptyChar = '-';
$progress->options->progressChar = $out->formatText('>', "red");
$progress->options->formatString = "Uploading file </tmp/foobar.tar.bz2>: %act%/%max% kb [%bar%]";
// Perform actions
$i = 0;
while ($i++ < 20) {
    // Do whatever you want to indicate progress for
    usleep(mt_rand(20000, 2000000));
    // Advance the progressbar by one step ( uploading 5k per run )
    $progress->advance();
}
// Finish progress bar and jump to next line.
$progress->finish();
$out->outputText("Successfully uploaded </tmp/foobar.tar.bz2>.\n", 'success');
/*
OUTPUT: (sequential, will be printed into 1 line and updated in reallife)
Uploading file </tmp/foobar.tar.bz2>:   5/100 kb [++#----------------------------------------------]
开发者ID:naderman,项目名称:pflow,代码行数:31,代码来源:example_progressbar.php

示例5: formatText

 /**
  * Returns the given $text formatted with $format.
  *
  * In case $useFormats is set to false in the output handler, the text is 
  * returned as given, without any formatting.
  * 
  * @param string $text 
  * @param string $format 
  * @return string
  */
 private function formatText($text, $format)
 {
     if ($this->outputHandler->options->useFormats) {
         return $this->outputHandler->formatText($text, $format);
     } else {
         return $text;
     }
 }
开发者ID:Adeelgill,项目名称:livehelperchat,代码行数:18,代码来源:table.php

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

示例7: ezcConsoleOutput

<?php

require 'ezc-setup.php';
$max = 23;
$output = new ezcConsoleOutput();
$output->formats->bar->color = 'red';
$output->formats->bar->style = array('bold');
$options = array('emptyChar' => ' ', 'barChar' => '-', 'formatString' => '%act% / %max% [' . $output->formatText('%bar%', 'bar') . '] %fraction%%');
$progress = new ezcConsoleProgressbar($output, $max, $options);
for ($i = 0; $i < $max; $i++) {
    usleep(20000);
    $progress->advance();
}
$progress->finish();
开发者ID:SandyS1,项目名称:presentations,代码行数:14,代码来源:consoletools-progressbar.php

示例8: ezcConsoleOutput

<?php

require_once 'tutorial_autoload.php';
$output = new ezcConsoleOutput();
$output->formats->bar->color = 'blue';
$output->formats->bar->style = array('bold');
$options = array('emptyChar' => ' ', 'barChar' => '-', 'formatString' => '%fraction%% <' . $output->formatText('%bar%', 'bar') . '> Uploaded %act% / %max% kb', 'redrawFrequency' => 50);
$bar = new ezcConsoleProgressbar($output, 1024, $options);
for ($i = 0; $i < 1024; $i++) {
    $bar->advance();
    usleep(mt_rand(200, 2000));
}
$bar->finish();
$output->outputLine();
开发者ID:sakshika,项目名称:ATM,代码行数:14,代码来源:tutorial_example_07_progressbar_advanced.php


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