Add a routing resource.

@param string $name
@param string $bundle
@param string $format
@param string $path
11196
public function addResource($name, $bundle, $format, $path = 'routing')
    {
        $resource = '@'.$bundle.$path.'.'.$format;
        $yaml = $this->getContent();
        if (!isset($yaml[$name]) || $yaml[$name]['resource'] != $resource) {
            $yaml[$name] = ['resource' => $resource];
            $this->setContent($yaml);
        }
    }
1016266
protected function addResourceUpdate( $name, $base, $controller, $options )
	{
		$uri = $this->getResourceUri( $name ) . '/{' . $base . '';

		$action = $this->getResourceAction( $name, $controller, 'update', $options );

		$this->router->match( ['PUT', 'PATCH'], $uri, $action );
	}
309080
public function addResource($bundle, $format, $path = 'config')
    {
        $resource = '@'.$bundle.$path.'.'.$format;

        $yaml = $this->getContent();
        $yaml['imports'] = isset($yaml['imports']) ? $yaml['imports'] : [];
        // check for duplicate
        foreach ($yaml['imports'] as $import) {
            if ($import['resource'] == $resource) {
                return;
            }
        }
        $yaml['imports'][] = ['resource' => $resource];
        $this->setContent($yaml);
    }
1023927
public function addScript($name, $path)
    {
        if (isset($this->scripts->$name)) {
            $this->scripts->$name[] = $path;
        } else {
            $this->scripts->$name = [$path];
        }

        return $this;
    }
1361850
protected function createRoutes(string $name): void
    {
        $apiFile = base_path($this->moduleName().'/'.$name.'/Routes/api.php');
        if (! $this->files->exists($apiFile)) {
            $this->files->put($apiFile, $this->files->get(__DIR__.'/stubs/routes/api.stub'));
        }

        $webFile = base_path($this->moduleName().'/'.$name.'/Routes/web.php');
        if (! $this->files->exists($webFile)) {
            $this->files->put($webFile, $this->files->get(__DIR__.'/stubs/routes/web.stub'));
        }
    }
665974
public static function registerHandler($path, $handler, $name = null)
    {
        $routeInfo             = [
            $path,
            $handler
        ];
        static::$routes[$path] = $routeInfo;
        if (!empty($name)) {
            self::$namedRoutes[$name] = $routeInfo;
        }
    }
618615
private function updateRouting(QuestionHelper $dialog, InputInterface $input, OutputInterface $output, BundleInterface $bundle, $format, $document, $prefix)
    {
        $auto = true;
        if ($input->isInteractive()) {
            $auto = $dialog->ask($input, $output, new ConfirmationQuestion($dialog->getQuestion('Confirm automatic update of the Routing', 'yes', '?')), true);
        }

        $configPath = $bundle->getPath().'/Resources/config';
        $routingFile = $configPath.'/routing.yml';

        $output->write('Importing the CRUD routes: ');
        $this->getFilesystem()->mkdir($configPath);
        $routing = new RoutingManipulator($routingFile);

        try {
            $ret = $auto ? $routing->addResource($bundle->getName(), $format, '/'.$prefix, 'routing/'.strtolower(str_replace('\\', '_', $document))) : false;
        } catch (\RuntimeException $exc) {
            $ret = false;
        }

        if ($ret) {
            return;
        }

        $help = sprintf("        <comment>resource: \"@%s/Resources/config/routing/%s.%s\"</comment>\n", $bundle->getName(), strtolower(str_replace('\\', '_', $document)), $format);
        $help .= sprintf("        <comment>prefix:   /%s</comment>\n", $prefix);

        return array(
            '- Import the bundle\'s routing resource in the bundle routing file',
            sprintf('  (%s).', $routingFile),
            '',
            sprintf('    <comment>%s:</comment>', $bundle->getName().('' !== $prefix ? '_'.str_replace('/', '_', $prefix) : '')),
            $help,
            '',
        );
    }
459864
protected function appendBreadcrumb($name, $label, $route = null, array $parameters = [])
    {
        $this->container->get('ekyna_admin.menu.builder')->breadcrumbAppend($name, $label, $route, $parameters);
    }
192844
public function addAttachment(
        $path,
        $name = '',
        $encoding = 'base64',
        $type = 'application/octet-stream',
        $disposition = 'attachment'
    ) {
        $this->_aAttachments[] = [$path, $name, $encoding, $type, $disposition];
        $result = false;

        try {
            $result = parent::addAttachment($path, $name, $encoding, $type, $disposition);
        } catch (Exception $exception) {
        }

        return $result;
    }
180525
public function useBoilerplate($path, $format = null)
    {
        $this->boilerplatePath = $path;
        $this->boilerplateFormat = $format;
        return $this;
    }
38097
protected function parseRoute(RouteCollection $collection, $name, array $config, $path)
    {
        $defaults = isset($config['defaults']) ? $config['defaults'] : array();
        $requirements = isset($config['requirements']) ? $config['requirements'] : array();
        $options = isset($config['options']) ? $config['options'] : array();
        $host = isset($config['host']) ? $config['host'] : '';
        $schemes = isset($config['schemes']) ? $config['schemes'] : array();
        $methods = isset($config['methods']) ? $config['methods'] : array();
        $condition = isset($config['condition']) ? $config['condition'] : null;
        if (isset($config['locales'])) {
            $collection->addCollection(
                $this->routeGenerator->generateRoutes(
                    $name,
                    $config['locales'],
                    new Route('', $defaults, $requirements, $options, $host, $schemes, $methods, $condition)
                )
            );
        } else {
            $route = new Route($config['path'], $defaults, $requirements, $options, $host, $schemes, $methods, $condition);
            $collection->add($name, $route);
        }
    }
809249
public function add($uri, $storage, $name = null, $methods = null){
        $route = new Route($uri, $storage, $methods);
        if($name !== null){
            $this->routes[$name] = $route;
        }else{
            $this->routes[] = $route;
        }
        return $route;
    }
1343542
public function put($path, $callable, $name = null) {
		return $this->add($path, $callable, $name, self::HTTP_METHOD_PUT);
	}
1152280
public function addOptions(string $uri, string $handler, string $name = null)
    {
        $this->addRoute("OPTIONS", $uri, $handler, $name);
    }
1306075
private function addRoute($name, array $route)
    {
        $this->rawRoutes[$name] = $route;

        $newRoute = new Route(
                $route['pattern'],
                $route['defaults'],
                array_key_exists('requirements', $route) ? $route['requirements'] : []
        );

        $this->add($name, $newRoute);

        $this->log('debug', sprintf('Route `%s` with pattern `%s` defined.', $name, $route['pattern']));
    }
545611
private function patchRouting(AbstractResourceBundle $bundle)
    {
        $routingPath = $bundle->getPath() . '/Resources/config/routing/';
        $prefix = $this->getBundlePrefix();
        $namePrefix = strtolower($this->getBundlePrefix($bundle) . '_' . $this->model);
        $bundleName = $bundle->getName();
        $entityClass = $this->getContainer()->get('doctrine')->getAliasNamespace($this->bundle->getName()) . '\\' . $this->model;

        $identifier = $this->getContainer()->get('doctrine')
            ->getManager()
            ->getClassMetadata($entityClass)
            ->getIdentifier();

        $this->renderFile('controller/routing/routing.yml.twig',
            $routingPath . strtolower($this->model) . '.yml',
            array(
                'route_name_prefix' => $namePrefix,
                'bundle' => $prefix,
                'entity' => $this->model,
                'identifier' => $identifier[0],
                'resource' => $bundle->getName(),
                'actions' => $this->configuration['actions']
            )
        );

        $path = $routingPath . 'main.yml';
        if (!file_exists($path)) {
            $path = $this->getContainer()->get('kernel')->getRootDir() . '/config/routing.yml';
        }

        $prefixName = strtolower($this->model);
        $nodeDeclaration = <<<EOF
$namePrefix:
    resource: @$bundleName/Resources/config/routing/$prefixName.yml
    prefix: /$prefixName
EOF;

        if (!$this->refExist($path, $namePrefix)) {
            $this->dumpFile($path, "\n" . $nodeDeclaration, false, false);
        }

        return null;
    }
665921
public function attach($name, RouteInterface $route)
    {
        if ($this->groupAttributes !== null) {
            // This route is part of a group of routes that share common attributes.
            // Merge those attributes with the existing options.
            $route->setOptions($this->groupAttributes);
        }

        $options = $route->getOptions();
        $method  = isset($options['method']) ? strtoupper($options['method']) : '*';
        $scheme  = isset($options['scheme']) ? $options['scheme'] : $this->defaultScheme;
        $this->routes[$scheme][$method][$name] = $route;

        return $this;
    }