RevisionCollection final class
Minn\Rest\RevisionCollection · public/minn/src/Minn/Rest/RevisionCollection.php · 177 lines
A revisions list as the reference answers it (probe of the posts, pages, patterns, menus, templates and global styles revisions routes): the include list (which outranks exclude) or the exclude list, the search (terms, quoted phrases and -exclusions over the title, excerpt and content, as a post search reads them), the order, then the page. An empty result is no pages at all. Without per_page every match is one page. An offset sent (zero too) is where a page of per_page starts, in the page number's place; one other than zero is refused at or past the total, and without one a page past the last is refused.
Public
| static | ofParent(?array $row, int $parent): Minn\Content\PostRecord# | The revision a single route asks for, refused as the reference refuses it: no revision by that id is an invalid id, one of another parent a mismatch naming the parent asked for.
| |||
| static | filtered(Minn\Http\Request $request, array $rows): array# | The rows the request's filters keep, in its order.
@return list<PostRecord> | |||
| static | paged(Minn\Http\Request $request, array $rows): array# | The page the request asks for, with the total and the page count.
@return array{0: list<T>, 1: int, 2: int} |
Internals 5
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | ids(mixed $value): array# | An id list argument as integers: a list, or a comma or space separated string. @return list<int> | |||||||||
| private | matches(Minn\Content\PostRecord $row, array $terms): bool# | Whether a revision matches every search term: an excluded term (a leading dash) in none of its columns, any other in one.
| |||||||||
| private | contains(string $haystack, string $needle): bool# | ||||||||||
| private | sorted(array $rows, string $orderby, int $direction, array $include, string $search, array $terms): array# | The rows in the asked order: by date with the id breaking ties, by id, by the include list's own order, by relevance (the whole search in the title, then every term there, then any, then by date), or by title or slug with ties left in id order.
@return list<PostRecord> | |||||||||
| private | rank(Minn\Content\PostRecord $row, string $search, array $terms): int# | A row's place in the relevance order, lowest first.
|
Nothing matches.