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


PHP Strings::indent方法代码示例

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


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

示例1: __toString

 /** @return string  PHP code */
 public function __toString()
 {
     $consts = array();
     foreach ($this->consts as $name => $value) {
         $consts[] = "const {$name} = " . PhpHelpers::dump($value) . ";\n";
     }
     $properties = array();
     foreach ($this->properties as $property) {
         $properties[] = ($property->documents ? str_replace("\n", "\n * ", "/**\n" . implode("\n", (array) $property->documents)) . "\n */\n" : '') . $property->visibility . ($property->static ? ' static' : '') . ' $' . $property->name . ($property->value === NULL ? '' : ' = ' . PhpHelpers::dump($property->value)) . ";\n";
     }
     return Strings::normalize(($this->documents ? str_replace("\n", "\n * ", "/**\n" . implode("\n", (array) $this->documents)) . "\n */\n" : '') . ($this->abstract ? 'abstract ' : '') . ($this->final ? 'final ' : '') . $this->type . ' ' . $this->name . ' ' . ($this->extends ? 'extends ' . implode(', ', (array) $this->extends) . ' ' : '') . ($this->implements ? 'implements ' . implode(', ', (array) $this->implements) . ' ' : '') . "\n{\n\n" . Strings::indent(($this->traits ? "use " . implode(', ', (array) $this->traits) . ";\n\n" : '') . ($this->consts ? implode('', $consts) . "\n\n" : '') . ($this->properties ? implode("\n", $properties) . "\n\n" : '') . implode("\n\n\n", $this->methods), 1) . "\n\n}") . "\n";
 }
开发者ID:riskatlas,项目名称:micka,代码行数:13,代码来源:ClassType.php

示例2: __toString

 /** @return string  PHP code */
 public function __toString()
 {
     $parameters = array();
     foreach ($this->parameters as $param) {
         $parameters[] = ($param->typeHint ? $param->typeHint . ' ' : '') . ($param->reference ? '&' : '') . '$' . $param->name . ($param->optional ? ' = ' . PhpHelpers::dump($param->defaultValue) : '');
     }
     $uses = array();
     foreach ($this->uses as $param) {
         $uses[] = ($param->reference ? '&' : '') . '$' . $param->name;
     }
     return ($this->documents ? str_replace("\n", "\n * ", "/**\n" . implode("\n", (array) $this->documents)) . "\n */\n" : '') . ($this->abstract ? 'abstract ' : '') . ($this->final ? 'final ' : '') . ($this->visibility ? $this->visibility . ' ' : '') . ($this->static ? 'static ' : '') . 'function' . ($this->returnReference ? ' &' : '') . ($this->name ? ' ' . $this->name : '') . '(' . implode(', ', $parameters) . ')' . ($this->uses ? ' use (' . implode(', ', $uses) . ')' : '') . ($this->abstract || $this->body === FALSE ? ';' : ($this->name ? "\n" : ' ') . "{\n" . Strings::indent(trim($this->body), 1) . "\n}");
 }
开发者ID:riskatlas,项目名称:micka,代码行数:13,代码来源:Method.php

示例3: indent

    /**
     * Indents the HTML content from the left.
     * @param  string UTF-8 encoding or 8-bit
     * @param  int
     * @param  string
     * @return string
     */
    public static function indent($s, $level = 1, $chars = "\t")
    {
        if ($level >= 1) {
            $s = Strings::replace($s, '#<(textarea|pre).*?</\\1#si', new Callback(create_function('$m', '
				return strtr($m[0], " \\t\\r\\n", "\\x1F\\x1E\\x1D\\x1A");
			')));
            $s = Strings::indent($s, $level, $chars);
            $s = strtr($s, "", " \t\r\n");
        }
        return $s;
    }
开发者ID:riskatlas,项目名称:micka,代码行数:18,代码来源:Helpers.php


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