Roller\Plugin\RESTful\ResourceHandler::expand PHP Метод

expand() статический публичный Метод

Expand resource handlers to routeset, in here, we define how to expand RESTful URLs from resource id, and which is customizable.
static public expand ( RouteSet $routes, $h, string $r )
$routes RouteSet
$r string resource identifier.
    static function expand($routes, $h, $r)
    {
        $class = is_object($h) ? get_class($h) : $h;
        $routes->add("/{$r}(.:format)", array($class, 'handleFind'), array('get' => true, 'default' => array('format' => 'json')));
        $routes->add('/' . $r . '(.:format)', array($class, 'handleCreate'), array('post' => true, 'default' => array('format' => 'json')));
        $routes->add('/' . $r . '/:id(.:format)', array($class, 'handleLoad'), array('get' => true, 'default' => array('format' => 'json')));
        $routes->add('/' . $r . '/:id(.:format)', array($class, 'handleUpdate'), array('put' => true, 'default' => array('format' => 'json')));
        $routes->add('/' . $r . '/:id(.:format)', array($class, 'handleDelete'), array('delete' => true, 'default' => array('format' => 'json')));
    }