====== ApiHateoas ======
**Layer:** ''Core'' · **Source:** ''lib/core/ApiHateoas.php:20'' (lines 20–344)
----
class ApiHateoas
API HATEOAS Links Generator
Generates Hypermedia as the Engine of Application State (HATEOAS)
links for RESTful API responses following RFC 5988 (Web Linking).
======= Docblock Metadata =======
^ Tag ^ Value ^
| ''@category'' | Core Class |
| ''@author'' | Blogware Team |
| ''@license'' | MIT |
| ''@version'' | 1.0 |
| ''@since'' | 1.0.0 |
======= Inheritance =======
//No parent, interface or trait. This is a root type.//
======= Constants (0) =======
//None.//
======= Properties (2) =======
^ Visibility ^ Type ^ Name ^ Default ^ Line ^
| ''private'' | ''(untyped)'' | ''$baseUrl'' | | 25 |
| ''private'' | ''(untyped)'' | ''$appUrl'' | | 30 |
======= Methods (8) =======
^ Visibility ^ Method ^ Summary ^ Line ^
| public | ''__construct()'' | Constructor | 37 |
| public | ''paginationLinks()'' | Generate HATEOAS links for a paginated collection | 53 |
| public | ''postLinks()'' | Generate HATEOAS links for a single post resource | 111 |
| public | ''categoryLinks()'' | Generate HATEOAS links for a single category resource | 151 |
| public | ''commentLinks()'' | Generate HATEOAS links for a single comment resource | 191 |
| public | ''archiveLinks()'' | Generate HATEOAS links for archive resources | 225 |
| public | ''rootLinks()'' | Generate HATEOAS root links (API info) | 263 |
| private | ''buildUrl()'' | Build a URL with pagination query parameters | 334 |
======== __construct() ========
public function __construct($baseUrl = null)
//lines 37–41 (5)//
Constructor
^ Parameter ^ Type ^ Default ^ Description ^
| ''$baseUrl'' | ''(untyped)'' | ''null'' | API base URL |
======== paginationLinks() ========
public function paginationLinks($resource, $currentPage, $perPage, $totalItems, $extraParams = [])
//lines 53–102 (50)//
Generate HATEOAS links for a paginated collection
^ Parameter ^ Type ^ Default ^ Description ^
| ''$resource'' | ''(untyped)'' | //required// | Resource name (e.g., 'posts', 'categories') |
| ''$currentPage'' | ''(untyped)'' | //required// | Current page number |
| ''$perPage'' | ''(untyped)'' | //required// | Items per page |
| ''$totalItems'' | ''(untyped)'' | //required// | Total number of items |
| ''$extraParams'' | ''(untyped)'' | ''[]'' | Additional query parameters |
**Returns:** ''(none declared)'' — array
======== postLinks() ========
public function postLinks($postId, $slug = '')
//lines 111–142 (32)//
Generate HATEOAS links for a single post resource
^ Parameter ^ Type ^ Default ^ Description ^
| ''$postId'' | ''(untyped)'' | //required// | Post ID |
| ''$slug'' | ''(untyped)'' | '''''' | Post slug |
**Returns:** ''(none declared)'' — array
======== categoryLinks() ========
public function categoryLinks($categoryId, $slug = '')
//lines 151–182 (32)//
Generate HATEOAS links for a single category resource
^ Parameter ^ Type ^ Default ^ Description ^
| ''$categoryId'' | ''(untyped)'' | //required// | Category ID |
| ''$slug'' | ''(untyped)'' | '''''' | Category slug |
**Returns:** ''(none declared)'' — array
======== commentLinks() ========
public function commentLinks($commentId, $postId = 0)
//lines 191–216 (26)//
Generate HATEOAS links for a single comment resource
^ Parameter ^ Type ^ Default ^ Description ^
| ''$commentId'' | ''(untyped)'' | //required// | Comment ID |
| ''$postId'' | ''(untyped)'' | ''0'' | Post ID |
**Returns:** ''(none declared)'' — array
======== archiveLinks() ========
public function archiveLinks($year, $month = null)
//lines 225–256 (32)//
Generate HATEOAS links for archive resources
^ Parameter ^ Type ^ Default ^ Description ^
| ''$year'' | ''(untyped)'' | //required// | Year |
| ''$month'' | ''(untyped)'' | ''null'' | Month (optional) |
**Returns:** ''(none declared)'' — array
======== rootLinks() ========
public function rootLinks()
//lines 263–323 (61)//
Generate HATEOAS root links (API info)
//Takes no parameters.//
**Returns:** ''(none declared)'' — array
======== buildUrl() ========
private function buildUrl($resource, $page, $perPage, $extraParams = [])
//lines 334–343 (10)//
Build a URL with pagination query parameters
^ Parameter ^ Type ^ Default ^ Description ^
| ''$resource'' | ''(untyped)'' | //required// | //none// |
| ''$page'' | ''(untyped)'' | //required// | //none// |
| ''$perPage'' | ''(untyped)'' | //required// | //none// |
| ''$extraParams'' | ''(untyped)'' | ''[]'' | //none// |
**Returns:** ''(none declared)'' — string
----
//This page is generated from source by 'tools/gendoc'. Edits will be overwritten.//