Add crud routes for a controller

@param  string $pattern
@param  string $callback
@param  array  $params

@return $this
337996
public function crud($pattern, $callback, array $params = [])
    {
        if (!is_string($callback)) {
            throw new \Exception('Crud callbacks must be a string to a controller class');
        }

        if (!empty($params['name'])) {
            $name = $params['name'];
        }

        $pattern  = rtrim($pattern, '/');
        $params['name'] = $name ? $name . '.create' : null;
        $this->post("{$pattern}", "{$callback}@create", $params);

        $params['name'] = $name ? $name . '.one' : null;
        $this->get("{$pattern}/(:any)", "{$callback}@one", $params);

        $params['name'] = $name ? $name . '.many' : null;
        $this->get("{$pattern}", "{$callback}@many", $params);

        $params['name'] = $name ? $name . '.update' : null;
        $this->put("{$pattern}/(:any)", "{$callback}@update", $params);

        $params['name'] = $name ? $name . '.delete' : null;
        $this->delete("{$pattern}/(:any)", "{$callback}@delete", $params);

        return $this;
    }
417685
public function setRoute($name, $pattern, array $replace = [], array $default = [])
    {
        $route = new \Mmi\Mvc\RouterConfigRoute;
        $route->name = $name;
        $route->pattern = $pattern;
        $route->replace = $replace;
        $route->default = $default;
        return $this->addRoute($route);
    }
250305
public function patch(string $pattern, $handler): Route
    {
        return $this->map($pattern, $handler)->method('PATCH');
    }
519990
private function buildUrlPatternFromPattern($pattern, array $parameters)
    {
        foreach ($parameters as $p) {
            $pattern = str_replace('{' . $p->name . '}', $p->matchPattern, $pattern, $rcount);
            if ($rcount < 1) {
                throw new RestException(sprintf('Missing parameter "%s" for "%s" method in the rest.url definition.',
                    $p->name, $this->method->getName()));
            }
        }

        return rtrim($pattern, '/') . '/';
    }
237804
public function any($uri, $pattern, array $options = [])
    {
        $patterns = explode('@', $pattern);
        $controller = $patterns[0];
        $method = ucfirst($patterns[1]);

        $this->get($uri, "$controller@get$method", $options);
        $this->post($uri, "$controller@post$method", $options);
    }
404892
public function post($pattern, $handler, array $requirements = [], array $defaults = [])
    {
        $this->addRoute('POST', $pattern, $handler, $requirements, $defaults);
    }
755369
public function setHost($pattern, array $defaults = [], array $requirements = [])
    {
        foreach ($this->routes as $route) {
            $route->setHost($pattern);
            $route->addDefaults($defaults);
            $route->addRequirements($requirements);
        }
    }
349268
public function pattern(string $parameter, string $pattern) : RouteBuilder
    {
        foreach ($this->routes as $route) {
            $route->tokens([
                $parameter => $pattern,
            ]);
        }
        return $this;
    }
601634
public function any($pattern, $action)
    {
        $this->addRoute($this->httpMethod, $pattern, $action);
        return $this;
    }
1081011
public function options($pattern, $action)
    {
        self::$rules[self::REQUEST_METHOD_OPTIONS . self::patternFactory($pattern)] = $action;
        return $this;
    }
841697
public function match($pattern, $to = null)
    {
        $route = clone $this->defaultRoute;
        $route->setPath($pattern);
        $this->controllers[] = $controller = new Controller($route);
        $route->setDefault('_controller', null === $to ? $this->defaultController : $to);

        return $controller;
    }
953160
public function addRoute($method, $route, $callback)
    {
        $route = $this->router->addRoute(strtoupper($method), $this->prefix . '/' . $route, $callback);

        $route->onAny(function($event, $arguments){
            $this->emit($event, $arguments);
        });

        $this->routes[] = $route;

        return $route;
    }
458807
public function rest($pattern, $action)
    {
        self::$rules[self::REST_ROUTE . self::patternFactory($pattern)] = $action;
        return $this;
    }
201371
public function all($pattern, $handler)
    {

        return $this->addRoute(
            new Route([Method::GET, Method::POST], $pattern, $handler)
        );
    }
489227
public function add($method, $pattern): RouteInterface
    {
        $route = new Route($this, $method);
        $route->setContainer($this->container);
        if (null !== $this->actionClass) {
            $route->setActionClass($this->actionClass);
        }
        if (null !== $this->requestClass) {
            $route->setRequestClass($this->requestClass);
        }
        $route->setPackage($this->getPackage());
        $prefixes = [$this->resourceName];
        if ($this->isSubResourceOfPackage()) {
            # Add package before resource
            array_unshift($prefixes, $this->packageName);
        }
        if ($this->routesPrefix) {
            # Add prefix before resource
            array_unshift($prefixes, $this->routesPrefix);
        }
        $pattern = $this->trailingSlash($pattern);
        $pattern = implode('/', $prefixes) . $pattern;
        $pattern = '/' . ltrim($pattern, '/');
        $route->setPattern($pattern);

        $this->data[] = $route;

        return $route;
    }
1003768
protected function createRoute($methods, $pattern, $callable)
	{
		$route = new Route($methods, $pattern, $callable, $this->routeGroups, $this->routeCounter);
		
		return $route;
	}
141782
public function put(string $url, $callback): Route
    {
        $route = new Route(['PUT'], $url, $callback);
        $this->addRoute($route);

        return $route;
    }