function AttributeRouteDiscovery::getReflectionClass
Same name and namespace in other branches
- main core/lib/Drupal/Core/Routing/AttributeRouteDiscovery.php \Drupal\Core\Routing\AttributeRouteDiscovery::getReflectionClass()
Gets a reflection class from the class name.
Parameters
class-string $className: The class to reflect.
Return value
\ReflectionClass<object>|null The Reflection class, is the class is a valid to check for routes, otherwise NULL. A class is invalid if there is an error on Reflection or if it is abstract.
1 call to AttributeRouteDiscovery::getReflectionClass()
- AttributeRouteDiscovery::collectRoutes in core/
lib/ Drupal/ Core/ Routing/ AttributeRouteDiscovery.php
File
-
core/
lib/ Drupal/ Core/ Routing/ AttributeRouteDiscovery.php, line 154
Class
- AttributeRouteDiscovery
- Discovers routes using Symfony's Route attribute.
Namespace
Drupal\Core\RoutingCode
private function getReflectionClass(string $className) : ?\ReflectionClass {
try {
$exists = class_exists($className);
} catch (\Error) {
// Ignore errors if a class extends a missing class, interface,
// or trait.
return NULL;
}
if ($exists) {
$class = new \ReflectionClass($className);
if (!$class->isAbstract()) {
return $class;
}
}
return NULL;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.