vendimia/helper
最新稳定版本:0.3
Composer 安装命令:
composer require vendimia/helper
包简介
Assorted helper classes
关键字:
README 文档
README
Vendimia\Helper\TextFromDocComment
Process a DocComment, (perhaps obtained with Reflection*::getDocComment() method), obtaining only the text with preceding or trailing spaces or empty lines removed. Also remove an initial * on each line.
public string $text
Processed text, also obtainable by using the class in a string context.
public function __construct(string $doc_comment, bool $merge_lines = true)
-
string $doc_comment: Original doc comment. -
bool $merge_lines:truemerges continuous non-empty lines as one, joined by a single empty space.falsereturns the lines as is.
Example
use Vendimia\Helper\TextFromDocComment; require __DIR__ . '/vendor/autoload.php'; /** * This is a dummy function. * * Its purpose is to hold a multiline doc comment to test the * Vendimia\Helper\TextFromDocComment class. */ function dummy() { } echo (string)new TextFromDocComment( new ReflectionFunction(dummy(...))->getDocComment() );
This outputs:
This is a dummy function.
Its purpose is to hold a multiline doc comment to test the Vendimia\Helper\TextFromDocComment class.
On PHP prior to 8.4, you must enclose new ReflectionFunction(dummy(...)) on parenthesis.
统计信息
- 总下载量: 50
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2024-10-03