public function has(string $routeName) : bool { try { $this->generator->generate($routeName, []); } catch (RouteNotFound $e) { return false; } return true; }
/** * * Generate the route without url encoding. * * @param string $name The route name to look up. * * @param array $data The data to interpolate into the URI; data keys * map to param tokens in the path. * * @return string|false A URI path string if the route name is found, or * boolean false if not. * * @throws Exception\RouteNotFound * */ public function generateRaw($name, $data = array()) { $route = $this->getRouteForGenerate($name); return $this->basepath . $this->generator->generateRaw($route, $data); }
public function createResponse(Payload $payload) { $resource = new Hal\Resource($this->generator->generate('manifest'), ['type' => 'wb:manifest', 'title' => 'Förstasidan', 'name' => $this->settings->read('app.name'), 'version' => $this->settings->read('app.version'), 'deploy' => $this->settings->read('app.deploy'), 'runtime' => phpversion()]); $resource->addLink('wb:contact-collection', $this->generator->generate('contacts.coll.read')); return new Hal\Response($resource); }
/** * Create resource wrapping an empty collection of claims * * @param string $selfRoute Name of route to generate self link from * @param string[] $selfParams Route params to use when generating self link * @return Resource */ public function createClaimCollectionResource($selfRoute = 'claims.coll.read', array $selfParams = []) { return new Resource($this->generator->generate($selfRoute, $selfParams), ['type' => 'wb:claim-collection', 'title' => 'Ansökningar']); }
/** * @param $routeName * @param array $arguments */ public function redirectToRoute($routeName, array $arguments = []) { header('Location: ' . '//' . $_SERVER['HTTP_HOST'] . '/' . trim($this->urlGenerator->generate($routeName, $arguments), '/')); $this->entityManager->flush(); die; }