funkyproject/reflection-file

此包的最新版本(v0.1)没有可用的许可信息。

v0.1 2014-04-02 16:24 UTC

This package is auto-updated.

Last update: 2024-09-05 02:41:15 UTC


README

使用 Attraktiv\ReflectionFile 从文件中检索有关类的许多信息。

Build Status Scrutinizer Code Quality Code Coverage

安装

您可以使用 composer 安装此库

composer require funkyproject/reflection-file

或将包添加到您的 composer.json 文件中

使用方法

use Funkyproject\ReflectionFIle;

$reflectionFile = new ReflectionFile($pathFileValid);
$reflectionFile->getName() // Namespace/ClassName
$instance = $reflectionFile->newInstance();

有关方法的更多信息,请访问 https://php.ac.cn/manual/en/class.reflectionclass.php

如果文件未找到,ReflectionFile 将抛出 FileNotFoundException

如果文件不是类,ReflectionFile 将抛出 ReflectionException

测试

您可以使用以下命令运行单元测试

 $ cd path/to/ReflectionFile/
 $ composer.phar install
 $ phpunit