Final Class Yiisoft\Proxy\ClassConfigFactory
| Inheritance | Yiisoft\Proxy\ClassConfigFactory |
|---|
Public Methods
| Method | Description | Defined By |
|---|---|---|
| getClassConfig() | Gets single class config based for individual class. | Yiisoft\Proxy\ClassConfigFactory |
Method Details
Gets single class config based for individual class.
| public Yiisoft\Proxy\Config\ClassConfig getClassConfig ( string $className ) | ||
| $className | string |
Full class or interface name (including namespace). |
| return | Yiisoft\Proxy\Config\ClassConfig |
Class config with all related configs (methods, parameters, types) linked. |
|---|---|---|
| throws | InvalidArgumentException |
In case class or interface does not exist. |
public function getClassConfig(string $className): ClassConfig
{
try {
$reflection = new ReflectionClass($className);
} catch (ReflectionException) {
throw new InvalidArgumentException("$className must exist.");
}
/**
* @psalm-suppress MixedArgumentTypeCoercion Can be removed after release
* https://github.com/vimeo/psalm/pull/8405
*/
return new ClassConfig(
isInterface: $reflection->isInterface(),
namespace: $reflection->getNamespaceName(),
modifiers: Reflection::getModifierNames($reflection->getModifiers()),
name: $reflection->getName(),
shortName: $reflection->getShortName(),
parent: (string) $reflection->getParentClass(),
interfaces: $reflection->getInterfaceNames(),
methods: $this->getMethodConfigs($reflection),
);
}
Signup or Login in order to comment.