本文整理汇总了PHP中Formatter::format方法的典型用法代码示例。如果您正苦于以下问题:PHP Formatter::format方法的具体用法?PHP Formatter::format怎么用?PHP Formatter::format使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Formatter
的用法示例。
在下文中一共展示了Formatter::format方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: format
/**
* Format the link.
*
* @param Link $link
*
* @return bool
*/
public final function format(Link $link)
{
$formatted = $this->formatting($link);
if (empty($formatted)) {
// the link has not been formatted by this formatter, try next formatter
if (!is_null($this->successor)) {
$formatted = $this->successor->format($link);
}
}
return $formatted;
}
示例2: testRootNode
public function testRootNode()
{
$snippet = <<<'END'
<?php
namespace Foo\Baz; class Blorg { public function __construct() {}}
END;
$expected = <<<'END'
<?php
namespace Foo\Baz;
class Blorg
{
public function __construct()
{
}
}
END;
$doc = Parser::parseSource($snippet);
$this->formatter->format($doc);
$this->assertEquals($expected, $doc->getText());
}
示例3: format
/**
* Méthode inutile ?
*/
private function format(Formatter $formater)
{
return $formater->format();
}
示例4: render_formatted_data
public function render_formatted_data($data)
{
$formatter = new Formatter();
echo $formatter->format($data);
}
示例5: format
/**
* @param $collection
* @param null $limit
*
* @return string
*/
public function format($collection, $limit = null)
{
return $this->formatter->format($collection, $limit);
}
示例6: format
/**
* Returns a formatted string using the specified locale, format string,
* and arguments.
*
* @param l
* The {@linkplain java.util.Locale locale} to apply during
* formatting. If <tt>l</tt> is <tt>null</tt> then no localization
* is applied.
*
* @param blaze\lang\String|string $format
* A <a href="../util/Formatter.html#syntax">format string</a>
*
* @param array[blaze\lang\Object] args
* Arguments referenced by the format specifiers in the format
* string. If there are more arguments than format specifiers, the
* extra arguments are ignored. The number of arguments is
* variable and may be zero. The maximum number of arguments is
* limited by the maximum dimension of a Java array as defined by
* the <a href="http://java.sun.com/docs/books/vmspec/">Java
* Virtual Machine Specification</a>. The behaviour on a
* <tt>null</tt> argument depends on the <a
* href="../util/Formatter.html#syntax">conversion</a>.
*
* @throws IllegalFormatException
* If a format string contains an illegal syntax, a format
* specifier that is incompatible with the given arguments,
* insufficient arguments given the format string, or other
* illegal conditions. For specification of all possible
* formatting errors, see the <a
* href="../util/Formatter.html#detail">Details</a> section of the
* formatter class specification
*
* @throws NullPointerException
* If the <tt>format</tt> is <tt>null</tt>
*
* @return blaze\lang\String A formatted string
*
* @see java.util.Formatter
* @since 1.5
*/
public static function format($format, $args, Locale $l = null)
{
$f = new Formatter($l);
return $f->format($format, $args)->toString();
}
示例7: underline
/**
* @param string $output
* @return string
*/
public function underline($output)
{
return parent::format($output, "", '<u style="text-decoration: underline;">', '</u>');
}
示例8: underline
/**
* @param string $output
* @return string
*/
public function underline($output)
{
return parent::format($output, "", "[4m", "[24m");
}