class RuntimeReflectionService in Plug 7
PHP Runtime Reflection Service.
@author Benjamin Eberlei <kontakt@beberlei.de>
Hierarchy
- class \Doctrine\Common\Persistence\Mapping\RuntimeReflectionService implements ReflectionService
Expanded class hierarchy of RuntimeReflectionService
1 file declares its use of RuntimeReflectionService
- RuntimeReflectionServiceTest.php in lib/
doctrine/ common/ tests/ Doctrine/ Tests/ Common/ Persistence/ Mapping/ RuntimeReflectionServiceTest.php
File
- lib/
doctrine/ common/ lib/ Doctrine/ Common/ Persistence/ Mapping/ RuntimeReflectionService.php, line 33
Namespace
Doctrine\Common\Persistence\MappingView source
class RuntimeReflectionService implements ReflectionService {
/**
* {@inheritDoc}
*/
public function getParentClasses($class) {
if (!class_exists($class)) {
throw MappingException::nonExistingClass($class);
}
return class_parents($class);
}
/**
* {@inheritDoc}
*/
public function getClassShortName($class) {
$reflectionClass = new ReflectionClass($class);
return $reflectionClass
->getShortName();
}
/**
* {@inheritDoc}
*/
public function getClassNamespace($class) {
$reflectionClass = new ReflectionClass($class);
return $reflectionClass
->getNamespaceName();
}
/**
* {@inheritDoc}
*/
public function getClass($class) {
return new ReflectionClass($class);
}
/**
* {@inheritDoc}
*/
public function getAccessibleProperty($class, $property) {
$reflectionProperty = new ReflectionProperty($class, $property);
if ($reflectionProperty
->isPublic()) {
$reflectionProperty = new RuntimePublicReflectionProperty($class, $property);
}
$reflectionProperty
->setAccessible(true);
return $reflectionProperty;
}
/**
* {@inheritDoc}
*/
public function hasPublicMethod($class, $method) {
try {
$reflectionMethod = new ReflectionMethod($class, $method);
} catch (ReflectionException $e) {
return false;
}
return $reflectionMethod
->isPublic();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RuntimeReflectionService:: |
public | function |
Returns an accessible property (setAccessible(true)) or null. Overrides ReflectionService:: |
|
RuntimeReflectionService:: |
public | function |
Returns a reflection class instance or null. Overrides ReflectionService:: |
|
RuntimeReflectionService:: |
public | function |
Overrides ReflectionService:: |
|
RuntimeReflectionService:: |
public | function |
Returns the shortname of a class. Overrides ReflectionService:: |
|
RuntimeReflectionService:: |
public | function |
Returns an array of the parent classes (not interfaces) for the given class. Overrides ReflectionService:: |
|
RuntimeReflectionService:: |
public | function |
Checks if the class have a public method with the given name. Overrides ReflectionService:: |