mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-03-12 18:46:10 +03:00
Merge branch 3.x
This commit is contained in:
commit
878c436698
@ -40,21 +40,31 @@ class ControllerReflector
|
|||||||
*
|
*
|
||||||
* @return \ReflectionMethod|null
|
* @return \ReflectionMethod|null
|
||||||
*/
|
*/
|
||||||
public function getReflectionMethod(string $controller)
|
public function getReflectionMethod($controller)
|
||||||
{
|
{
|
||||||
$callable = $this->getClassAndMethod($controller);
|
if (is_string($controller)) {
|
||||||
if (null === $callable) {
|
$controller = $this->getClassAndMethod($controller);
|
||||||
return;
|
if (null === $controller) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
list($class, $method) = $callable;
|
return $this->geReflectionMethodByClassNameAndMethodName(...$controller);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return \ReflectionMethod|null
|
||||||
|
*/
|
||||||
|
public function geReflectionMethodByClassNameAndMethodName(string $class, string $method)
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
return new \ReflectionMethod($class, $method);
|
return new \ReflectionMethod($class, $method);
|
||||||
} catch (\ReflectionException $e) {
|
} catch (\ReflectionException $e) {
|
||||||
// In case we can't reflect the controller, we just
|
// In case we can't reflect the controller, we just
|
||||||
// ignore the route
|
// ignore the route
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getClassAndMethod(string $controller)
|
private function getClassAndMethod(string $controller)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user