Args final class
Minn\Http\Args · public/minn/src/Minn/Http/Args.php · 149 lines
The parameters a route accepts, as the reference describes them in the REST index: name => {description, type, ...}. The descriptions, types, enums and bounds were captured from the reference, so a client that reads either index is told the same thing, and the router refuses a value the way the reference refuses it, before it judges the caller.
A route declares only what it really reads. An argument published here that the handler ignores would be worse than none at all, because a client reading the index would build a request around it, so each set below names the code that consumes it. The sets keep the reference's order, because a refusal lists the invalid parameters in that order. `_fields` and `_embed` are read everywhere and declared nowhere, as the reference lists neither and validates neither.
Used by 22 (show)
Constants and properties
| const | SHARED = array ( 0 => 'context', 1 => 'page', 2 => 'per_page', 3 => 'search', ) | The shared collection parameters, judged first: the reference answers a refusal among these alone, and reads the route's own parameters only once these pass. |
| const | HANDLER_VALIDATES = 'handler_validates' | The key an argument carries when its handler judges it (a status the caller may not read is refused before the enum is). |
| const | CONTEXT = array ( 'context' => array ( 'description' => 'Scope under which the request is made; determines fields present in response.', 'type' => 'string', 'enum' => array ( 0 => 'view', 1 => 'embed', 2 => 'edit', ), 'default' => 'view', 'required' => false, ), ) | Read by Rest\Context::of(): which view of a resource is wanted. |
| const | FORCE = array ( 'force' => array ( 'description' => 'Whether to bypass Trash and force deletion.', 'type' => 'boolean', 'default' => false, 'required' => false, ), ) | Read by Content\PostWriter: whether a delete bypasses the trash. |
| const | USERS = array ( 'page' => array ( 'description' => 'Current page of the collection.', 'type' => 'integer', 'default' => 1, 'minimum' => 1, 'required' => false, ), 'per_page' => array ( 'description' => 'Maximum number of items to be returned in result set.', 'type' => 'integer', 'default' => 10, 'minimum' => 1, 'maximum' => 100, 'required' => false, ), 'search' => array ( 'description' => 'Limit results to those matching a string.', 'type' => 'string', 'required' => false, ), 'exclude' => array ( 'description' => 'Ensure result set excludes specific IDs.', 'type' => 'array', 'items' => array ( 'type' => 'integer', ), 'default' => array ( ), 'required' => false, ), 'include' => array ( 'description' => 'Limit result set to specific IDs.', 'type' => 'array', 'items' => array ( 'type' => 'integer', ), 'default' => array ( ), 'required' => false, ), 'offset' => array ( 'description' => 'Offset the result set by a specific number of items.', 'type' => 'integer', 'required' => false, ), 'order' => array ( 'default' => 'asc', 'description' => 'Order sort attribute ascending or descending.', 'enum' => array ( 0 => 'asc', 1 => 'desc', ), 'type' => 'string', 'required' => false, ), 'orderby' => array ( 'default' => 'name', 'description' => 'Sort collection by user attribute.', 'enum' => array ( 0 => 'id', 1 => 'include', 2 => 'name', 3 => 'registered_date', 4 => 'slug', 5 => 'include_slugs', 6 => 'email', 7 => 'url', ), 'type' => 'string', 'required' => false, ), 'slug' => array ( 'description' => 'Limit result set to users with one or more specific slugs.', 'type' => 'array', 'items' => array ( 'type' => 'string', ), 'required' => false, ), 'roles' => array ( 'description' => 'Limit result set to users matching at least one specific role provided. Accepts csv list or single role.', 'type' => 'array', 'items' => array ( 'type' => 'string', ), 'required' => false, ), 'capabilities' => array ( 'description' => 'Limit result set to users matching at least one specific capability provided. Accepts csv list or single capability.', 'type' => 'array', 'items' => array ( 'type' => 'string', ), 'required' => false, ), 'who' => array ( 'description' => 'Limit result set to users who are considered authors.', 'type' => 'string', 'enum' => array ( 0 => 'authors', ), 'required' => false, ), 'has_published_posts' => array ( 'description' => 'Limit result set to users who have published posts.', 'type' => array ( 0 => 'boolean', 1 => 'array', ), 'items' => array ( 'type' => 'string', 'enum' => array ( ), ), 'required' => false, ), 'search_columns' => array ( 'default' => array ( ), 'description' => 'Array of column names to be searched.', 'type' => 'array', 'items' => array ( 'enum' => array ( 0 => 'email', 1 => 'name', 2 => 'id', 3 => 'username', 4 => 'slug', ), 'type' => 'string', ), 'required' => false, ), ) | Read by Rest\UserCollectionParams: the user collection. |
| const | TERMS = array ( 'page' => array ( 'description' => 'Current page of the collection.', 'type' => 'integer', 'default' => 1, 'minimum' => 1, 'required' => false, ), 'per_page' => array ( 'description' => 'Maximum number of items to be returned in result set.', 'type' => 'integer', 'default' => 10, 'minimum' => 1, 'maximum' => 100, 'required' => false, ), 'search' => array ( 'description' => 'Limit results to those matching a string.', 'type' => 'string', 'required' => false, ), 'exclude' => array ( 'description' => 'Ensure result set excludes specific IDs.', 'type' => 'array', 'items' => array ( 'type' => 'integer', ), 'default' => array ( ), 'required' => false, ), 'include' => array ( 'description' => 'Limit result set to specific IDs.', 'type' => 'array', 'items' => array ( 'type' => 'integer', ), 'default' => array ( ), 'required' => false, ), 'offset' => array ( 'description' => 'Offset the result set by a specific number of items.', 'type' => 'integer', 'required' => false, ), 'order' => array ( 'description' => 'Order sort attribute ascending or descending.', 'type' => 'string', 'default' => 'asc', 'enum' => array ( 0 => 'asc', 1 => 'desc', ), 'required' => false, ), 'orderby' => array ( 'description' => 'Sort collection by term attribute.', 'type' => 'string', 'default' => 'name', 'enum' => array ( 0 => 'id', 1 => 'include', 2 => 'name', 3 => 'slug', 4 => 'include_slugs', 5 => 'term_group', 6 => 'description', 7 => 'count', ), 'required' => false, ), 'hide_empty' => array ( 'description' => 'Whether to hide terms not assigned to any posts.', 'type' => 'boolean', 'default' => false, 'required' => false, ), 'parent' => array ( 'description' => 'Limit result set to terms assigned to a specific parent.', 'type' => 'integer', 'required' => false, ), 'post' => array ( 'description' => 'Limit result set to terms assigned to a specific post.', 'type' => 'integer', 'default' => NULL, 'required' => false, ), 'slug' => array ( 'description' => 'Limit result set to terms with one or more specific slugs.', 'type' => 'array', 'items' => array ( 'type' => 'string', ), 'required' => false, ), ) | Read by Rest\TermCollectionParams: a term collection, either shape. |
| const | COMMENTS = array ( 'page' => array ( 'description' => 'Current page of the collection.', 'type' => 'integer', 'default' => 1, 'minimum' => 1, 'required' => false, ), 'per_page' => array ( 'description' => 'Maximum number of items to be returned in result set.', 'type' => 'integer', 'default' => 10, 'minimum' => 1, 'maximum' => 100, 'required' => false, ), 'search' => array ( 'description' => 'Limit results to those matching a string.', 'type' => 'string', 'required' => false, ), 'after' => array ( 'description' => 'Limit response to comments published after a given ISO8601 compliant date.', 'type' => 'string', 'format' => 'date-time', 'required' => false, ), 'author' => array ( 'description' => 'Limit result set to comments assigned to specific user IDs. Requires authorization.', 'type' => 'array', 'items' => array ( 'type' => 'integer', ), 'required' => false, ), 'author_exclude' => array ( 'description' => 'Ensure result set excludes comments assigned to specific user IDs. Requires authorization.', 'type' => 'array', 'items' => array ( 'type' => 'integer', ), 'required' => false, ), 'author_email' => array ( 'default' => NULL, 'description' => 'Limit result set to that from a specific author email. Requires authorization.', 'format' => 'email', 'type' => 'string', 'required' => false, ), 'before' => array ( 'description' => 'Limit response to comments published before a given ISO8601 compliant date.', 'type' => 'string', 'format' => 'date-time', 'required' => false, ), 'exclude' => array ( 'description' => 'Ensure result set excludes specific IDs.', 'type' => 'array', 'items' => array ( 'type' => 'integer', ), 'default' => array ( ), 'required' => false, ), 'include' => array ( 'description' => 'Limit result set to specific IDs.', 'type' => 'array', 'items' => array ( 'type' => 'integer', ), 'default' => array ( ), 'required' => false, ), 'offset' => array ( 'description' => 'Offset the result set by a specific number of items.', 'type' => 'integer', 'required' => false, ), 'order' => array ( 'description' => 'Order sort attribute ascending or descending.', 'type' => 'string', 'default' => 'desc', 'enum' => array ( 0 => 'asc', 1 => 'desc', ), 'required' => false, ), 'orderby' => array ( 'description' => 'Sort collection by comment attribute.', 'type' => 'string', 'default' => 'date_gmt', 'enum' => array ( 0 => 'date', 1 => 'date_gmt', 2 => 'id', 3 => 'include', 4 => 'post', 5 => 'parent', 6 => 'type', ), 'required' => false, ), 'parent' => array ( 'default' => array ( ), 'description' => 'Limit result set to comments of specific parent IDs.', 'type' => 'array', 'items' => array ( 'type' => 'integer', ), 'required' => false, ), 'parent_exclude' => array ( 'default' => array ( ), 'description' => 'Ensure result set excludes specific parent IDs.', 'type' => 'array', 'items' => array ( 'type' => 'integer', ), 'required' => false, ), 'post' => array ( 'default' => array ( ), 'description' => 'Limit result set to comments assigned to specific post IDs.', 'type' => 'array', 'items' => array ( 'type' => 'integer', ), 'required' => false, ), 'status' => array ( 'default' => 'approve', 'description' => 'Limit result set to comments assigned a specific status. Requires authorization.', 'type' => 'string', 'required' => false, ), 'type' => array ( 'default' => 'comment', 'description' => 'Limit result set to comments assigned a specific type. Requires authorization.', 'type' => 'string', 'required' => false, ), 'password' => array ( 'description' => 'The password for the post if it is password protected.', 'type' => 'string', 'required' => false, ), ) | Read by Rest\CommentsController::list(): the comment collection. |
| const | USER_CREATE = array ( 'username' => array ( 'description' => 'Login name for the user.', 'type' => 'string', 'required' => true, ), 'name' => array ( 'description' => 'Display name for the user.', 'type' => 'string', 'required' => false, ), 'first_name' => array ( 'description' => 'First name for the user.', 'type' => 'string', 'required' => false, ), 'last_name' => array ( 'description' => 'Last name for the user.', 'type' => 'string', 'required' => false, ), 'email' => array ( 'description' => 'The email address for the user.', 'type' => 'string', 'format' => 'email', 'required' => true, ), 'url' => array ( 'description' => 'URL of the user.', 'type' => 'string', 'format' => 'uri', 'required' => false, ), 'description' => array ( 'description' => 'Description of the user.', 'type' => 'string', 'required' => false, ), 'locale' => array ( 'description' => 'Locale for the user.', 'type' => 'string', 'required' => false, ), 'nickname' => array ( 'description' => 'The nickname for the user.', 'type' => 'string', 'required' => false, ), 'roles' => array ( 'description' => 'Roles assigned to the user.', 'type' => 'array', 'items' => array ( 'type' => 'string', ), 'required' => false, ), 'password' => array ( 'description' => 'Password for the user (never included).', 'type' => 'string', 'required' => true, ), ) | Read by Rest\UsersController::create(): the body of a user create. The locale takes any string here; the reference's enum is the site's installed languages, which is not a constant. |
| const | USER_EDIT = array ( 'name' => array ( 'description' => 'Display name for the user.', 'type' => 'string', 'required' => false, ), 'first_name' => array ( 'description' => 'First name for the user.', 'type' => 'string', 'required' => false, ), 'last_name' => array ( 'description' => 'Last name for the user.', 'type' => 'string', 'required' => false, ), 'email' => array ( 'description' => 'The email address for the user.', 'type' => 'string', 'format' => 'email', 'required' => false, ), 'url' => array ( 'description' => 'URL of the user.', 'type' => 'string', 'format' => 'uri', 'required' => false, ), 'description' => array ( 'description' => 'Description of the user.', 'type' => 'string', 'required' => false, ), 'locale' => array ( 'description' => 'Locale for the user.', 'type' => 'string', 'required' => false, ), 'nickname' => array ( 'description' => 'The nickname for the user.', 'type' => 'string', 'required' => false, ), 'slug' => array ( 'description' => 'An alphanumeric identifier for the user.', 'type' => 'string', 'required' => false, ), 'roles' => array ( 'description' => 'Roles assigned to the user.', 'type' => 'array', 'items' => array ( 'type' => 'string', ), 'required' => false, ), 'password' => array ( 'description' => 'Password for the user (never included).', 'type' => 'string', 'required' => false, ), 'meta' => array ( 'description' => 'Meta fields.', 'type' => 'object', 'properties' => array ( 'show_admin_bar_front' => array ( 'type' => 'string', 'default' => 'true', ), ), 'required' => false, ), ) | Read by Rest\UsersController::update(): the body of a user edit; nothing is required. |
| const | USER_DELETE = array ( 'force' => array ( 'type' => 'boolean', 'default' => false, 'description' => 'Required to be true, as users do not support trashing.', 'required' => false, ), 'reassign' => array ( 'type' => 'integer', 'description' => 'Reassign the deleted user\'s posts and links to this user ID.', 'required' => true, 'handler_validates' => true, ), ) | Read by Rest\UsersController::delete(): the reassignment a user delete requires, and the force it insists on. |
| const | APPLICATION_PASSWORD = array ( 'app_id' => array ( 'description' => 'A UUID provided by the application to uniquely identify it. It is recommended to use an UUID v5 with the URL or DNS namespace.', 'type' => 'string', 'oneOf' => array ( 0 => array ( 'type' => 'string', 'format' => 'uuid', ), 1 => array ( 'type' => 'string', 'enum' => array ( 0 => '', ), ), ), 'required' => false, ), 'name' => array ( 'description' => 'The name of the application password.', 'type' => 'string', 'minLength' => 1, 'pattern' => '.*\\S.*', 'required' => true, ), ) | Read by Rest\ApplicationPasswordsController::create(): the body of a new application password. |
| const | SEARCH = array ( 'context' => array ( 'description' => 'Scope under which the request is made; determines fields present in response.', 'type' => 'string', 'enum' => array ( 0 => 'view', 1 => 'embed', ), 'default' => 'view', 'required' => false, ), 'page' => array ( 'description' => 'Current page of the collection.', 'type' => 'integer', 'default' => 1, 'minimum' => 1, 'required' => false, ), 'per_page' => array ( 'description' => 'Maximum number of items to be returned in result set.', 'type' => 'integer', 'default' => 10, 'minimum' => 1, 'maximum' => 100, 'required' => false, ), 'search' => array ( 'description' => 'Limit results to those matching a string.', 'type' => 'string', 'required' => false, ), 'type' => array ( 'default' => 'post', 'description' => 'Limit results to items of an object type.', 'type' => 'string', 'enum' => array ( 0 => 'post', 1 => 'term', 2 => 'post-format', ), 'required' => false, 'handler_validates' => true, ), 'subtype' => array ( 'default' => 'any', 'description' => 'Limit results to items of one or more object subtypes.', 'type' => 'array', 'items' => array ( 'enum' => array ( 0 => 'post', 1 => 'page', 2 => 'category', 3 => 'post_tag', 4 => 'any', ), 'type' => 'string', ), 'required' => false, 'handler_validates' => true, ), ) | Read by Rest\SearchController::list(): the search collection, whose context has no edit view. |
Public
| static | merge(array $sets): array# | The sets merged into one map, as a route's endpoint publishes them.
@return array<string, array<string, mixed>> |
Nothing matches.