scheb / implementation-iterator
该包已被废弃,不再维护。未建议替代包。
迭代PSR-4兼容目录中类的接口实现
v1.0.0
2015-03-22 10:52 UTC
Requires
- php: >=5.3.0
Requires (Dev)
- satooshi/php-coveralls: ~0.6
This package is auto-updated.
Last update: 2022-01-11 13:25:26 UTC
README
此库为PSR-4兼容文件夹结构创建迭代器,并搜索其中的接口/类的所有实现/扩展。将忽略抽象实现和类本身。
使用方法
$iterator = new \Scheb\ImplementationIterator("src/", "Root\Namespace", "Some\Class\Or\Interface"); foreach ($iterator as $className) { echo $className . "\n"; }
将返回类似
Root\Namespace\Foo\Implementation
Root\Namespace\Bar\OtherImplementation
...
或者你也可以有一个迭代器,它返回ReflectionClass实例而不是类名
$iterator = new \Scheb\ImplementationReflectionIterator("src/", "Root\Namespace", "Some\Class\Or\Interface"); foreach ($iterator as $reflection) { echo $reflection->getName() . "\n"; }
许可证
此库在MIT许可证下可用。