src/Viserio/Component/Routing/ResourceRegistrar.php
public function register(string $name, string $controller, array $options = []): void
    {
        if (isset($options['parameters']) && \count($this->parameters) === 0) {
            $this->parameters = (array) $options['parameters'];
        }

        // If the resource name contains a slash, we will assume the developer wishes to
        // register these resource routes with a prefix so we will set that up out of
        // the box so they don't have to mess with it. Otherwise, we will continue.
        if (\strpos($name, '/') !== false) {
            $this->prefixedResource($name, $controller, $options);

            return;
        }

        // We need to extract the base resource from the resource name.
        $baseResource = \explode('.', $name);
        $resource     = \end($baseResource);

        // Wildcards for a single or nested resource may be overridden using the wildcards option.
        // Overrides are performed by matching the wildcards key with the resource name. If a key
        // matches a resource name, the value of the wildcard is used instead of the resource name.
        if (isset($options['wildcards'][$resource])) {
            $resource = $options['wildcards'][$resource];
        }

        // Nested resources are supported in the framework, but we need to know what
        // name to use for a place-holder on the route wildcards, which should be
        // the base resources.
        $base = $this->getResourceWildcard($resource);

        $defaults = self::$resourceDefaults;

        foreach ($this->getResourceMethods($defaults, $options) as $m) {
            $this->{'addResource' . \ucfirst($m)}($name, $base, $controller, $options);
        }
    }
public function register(string $name, string $controller, array $options = []): void
    {
        if (isset($options['parameters']) && \count($this->parameters) === 0) {
            $this->parameters = (array) $options['parameters'];
        }

        // If the resource name contains a slash, we will assume the developer wishes to
        // register these resource routes with a prefix so we will set that up out of
        // the box so they don't have to mess with it. Otherwise, we will continue.
        if (\strpos($name, '/') !== false) {
            $this->prefixedResource($name, $controller, $options);

            return;
        }

        // We need to extract the base resource from the resource name.
        $baseResource = \explode('.', $name);
        $resource     = \end($baseResource);

        // Wildcards for a single or nested resource may be overridden using the wildcards option.
        // Overrides are performed by matching the wildcards key with the resource name. If a key
        // matches a resource name, the value of the wildcard is used instead of the resource name.
        if (isset($options['wildcards'][$resource])) {
            $resource = $options['wildcards'][$resource];
        }

        // Nested resources are supported in the framework, but we need to know what
        // name to use for a place-holder on the route wildcards, which should be
        // the base resources.
        $base = $this->getResourceWildcard($resource);

        $defaults = self::$resourceDefaults;

        foreach ($this->getResourceMethods($defaults, $options) as $m) {
            $this->{'addResource' . \ucfirst($m)}($name, $base, $controller, $options);
        }
    }
Route a resource to a controller.

@param string $name
@param string $controller
@param array  $options

@return void