funivan/php-tokenizer
最新稳定版本:0.3.0
Composer 安装命令:
composer require funivan/php-tokenizer
包简介
Wrapper around token_get_all. Easy to extract and modify php code.
关键字:
README 文档
README
Wrapper around token_get_all. Easy to extract and modify tokens
Install
Via Composer
composer require funivan/php-tokenizer
Usage
Reformat our code like PhpStorm. Lets create rule: place single spaces after while
use Funivan\PhpTokenizer\Collection; use Funivan\PhpTokenizer\Pattern\PatternMatcher; use Funivan\PhpTokenizer\QuerySequence\QuerySequence; $source = "<?php while(){}"; // while (){} $collection = Collection::createFromString($source); (new PatternMatcher($collection))->apply(function (QuerySequence $checker) { $while = $checker->strict('while'); $space = $checker->possible(T_WHITESPACE); if ($checker->isValid()) { $space->remove(); $while->appendToValue(" "); } }); echo (string) $collection;
Documentation
Testing
./vendor/bin/phpunit
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 38.46k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 12
- 点击次数: 0
- 依赖项目数: 4
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-05-18