/** * Get Handler * * @param OperationReference $operation * * @return array */ public function getHandler(OperationReference $operation) { // remove route parameters $path = preg_replace('/\\/\\{.*\\}/', '', $operation->getPath()); // lowerCamelCase to UpperCamelCase $paths = explode('/', $path); // path start with a / unset($paths[0]); $paths = array_map(function ($path) { return ucfirst($path); }, $paths); // path to 'relative' namespace $path = implode('\\', $paths); $controller = $this->namespace . $path . 'Controller'; return ['uses' => $controller . '@' . $this->httpVerbToControllerMethod[strtoupper($operation->getMethod())], 'as' => $operation->getOperationId()]; }