| Next revision | Previous revision |
| scriptlog:lib:controller:apicontroller [2026/09/26 09:09] – admin admin | scriptlog:lib:controller:apicontroller [2026/09/26 09:34] (current) – admin admin |
|---|
| ======= Docblock Metadata ======= | ======= Docblock Metadata ======= |
| |
| ^ Tag ^ Value ^ | ^ Tag ^ Value ^ |
| | ''@category'' | Controller Class | | | ''@category'' | Controller Class | |
| | ''@author'' | Blogware Team | | | ''@author'' | Blogware Team | |
| | ''@license'' | MIT | | | ''@license'' | MIT | |
| | ''@version'' | 1.0 | | | ''@version'' | 1.0 | |
| | ''@since'' | Since Release 1.0 | | | ''@since'' | Since Release 1.0 | |
| |
| ======= Inheritance ======= | ======= Inheritance ======= |
| ======= Properties (5) ======= | ======= Properties (5) ======= |
| |
| ^ Visibility ^ Type ^ Name ^ Default ^ Line ^ | ^ Visibility ^ Type ^ Name ^ Default ^ Line ^ |
| | ''protected'' | ''(untyped)'' | ''$requestData'' | ''[];'' | 31 | | | ''protected'' | ''(untyped)'' | ''$requestData'' | ''[]'' | 31 | |
| | ''protected'' | ''(untyped)'' | ''$queryParams'' | ''[];'' | 36 | | | ''protected'' | ''(untyped)'' | ''$queryParams'' | ''[]'' | 36 | |
| | ''protected'' | ''(untyped)'' | ''$method'' | '''GET';'' | 41 | | | ''protected'' | ''(untyped)'' | ''$method'' | '''GET''' | 41 | |
| | ''protected'' | ''(untyped)'' | ''$headers'' | ''[];'' | 48 | | | ''protected'' | ''(untyped)'' | ''$headers'' | ''[]'' | 48 | |
| | ''protected'' | ''(untyped)'' | ''$requiresAuth'' | ''true;'' | 53 | | | ''protected'' | ''(untyped)'' | ''$requiresAuth'' | ''true'' | 53 | |
| |
| ======= Methods (16) ======= | ======= Methods (16) ======= |
| |
| ^ Visibility ^ Method ^ Summary ^ Line ^ | ^ Visibility ^ Method ^ Summary ^ Line ^ |
| | public | ''__construct()'' | Constructor | 58 | | | public | ''__construct()'' | Constructor | 58 | |
| | protected | ''getHeaders()'' | Get request headers | 84 | | | protected | ''getHeaders()'' | Get request headers | 84 | |
| | protected | ''getRequestData()'' | Get request data based on HTTP method | 103 | | | protected | ''getRequestData()'' | Get request data based on HTTP method | 103 | |
| | protected | ''validateContentType()'' | Validate Content-Type for write requests | 152 | | | protected | ''validateContentType()'' | Validate Content-Type for write requests | 152 | |
| | protected | ''getJsonBody()'' | Get JSON body from request | 187 | | | protected | ''getJsonBody()'' | Get JSON body from request | 187 | |
| | protected | ''authenticate()'' | Authenticate the request | 208 | | | protected | ''authenticate()'' | Authenticate the request | 208 | |
| | protected | ''isAuthenticated()'' | Check if user is authenticated | 231 | | | protected | ''isAuthenticated()'' | Check if user is authenticated | 231 | |
| | protected | ''getUser()'' | Get authenticated user | 243 | | | protected | ''getUser()'' | Get authenticated user | 243 | |
| | protected | ''hasPermission()'' | Check if user has permission | 254 | | | protected | ''hasPermission()'' | Check if user has permission | 254 | |
| | protected | ''validateRequired()'' | Validate required fields | 266 | | | protected | ''validateRequired()'' | Validate required fields | 266 | |
| | protected | ''validateEmail()'' | Validate email format | 288 | | | protected | ''validateEmail()'' | Validate email format | 288 | |
| | protected | ''getAppUrl()'' | Get application URL from config | 298 | | | protected | ''getAppUrl()'' | Get application URL from config | 298 | |
| | protected | ''sanitize()'' | Sanitize string input | 309 | | | protected | ''sanitize()'' | Sanitize string input | 309 | |
| | protected | ''getPagination()'' | Get pagination parameters | 324 | | | protected | ''getPagination()'' | Get pagination parameters | 324 | |
| | protected | ''getSorting()'' | Get sorting parameters | 344 | | | protected | ''getSorting()'' | Get sorting parameters | 344 | |
| | public | ''info()'' | API info endpoint | 370 | | | public | ''info()'' | API info endpoint | 370 | |
| |
| |
| Check if user has permission | Check if user has permission |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$requiredLevels'' | ''(untyped)'' | //required// | //none// | | | ''$requiredLevels'' | ''(untyped)'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' — bool | **Returns:** ''(none declared)'' — bool |
| Validate required fields | Validate required fields |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$data'' | ''(untyped)'' | //required// | Data to validate | | | ''$data'' | ''(untyped)'' | //required// | Data to validate | |
| | ''$required'' | ''(untyped)'' | //required// | Required fields | | | ''$required'' | ''(untyped)'' | //required// | Required fields | |
| |
| **Returns:** ''(none declared)'' — array|null Validation errors or null if valid | **Returns:** ''(none declared)'' — array|null Validation errors or null if valid |
| Validate email format | Validate email format |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$email'' | ''(untyped)'' | //required// | //none// | | | ''$email'' | ''(untyped)'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' — bool | **Returns:** ''(none declared)'' — bool |
| Sanitize string input | Sanitize string input |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$value'' | ''(untyped)'' | //required// | //none// | | | ''$value'' | ''(untyped)'' | //required// | //none// | |
| |
| **Returns:** ''(none declared)'' — array|string | **Returns:** ''(none declared)'' — array|string |
| Get pagination parameters | Get pagination parameters |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$params'' | ''(untyped)'' | //required// | Query parameters | | | ''$params'' | ''(untyped)'' | //required// | Query parameters | |
| |
| **Returns:** ''(none declared)'' — array | **Returns:** ''(none declared)'' — array |
| Get sorting parameters | Get sorting parameters |
| |
| ^ Parameter ^ Type ^ Default ^ Description ^ | ^ Parameter ^ Type ^ Default ^ Description ^ |
| | ''$params'' | ''(untyped)'' | //required// | Query parameters | | | ''$params'' | ''(untyped)'' | //required// | Query parameters | |
| | ''$allowedFields'' | ''(untyped)'' | ''[]'' | Allowed sort fields | | | ''$allowedFields'' | ''(untyped)'' | ''[]'' | Allowed sort fields | |
| |
| **Returns:** ''(none declared)'' — array | **Returns:** ''(none declared)'' — array |
| ======= Imports ======= | ======= Imports ======= |
| |
| ^ Alias ^ Fully-qualified name ^ | ^ Alias ^ Fully-qualified name ^ |
| | ''ApiAuth'' | [[scriptlog:lib:core:apiauth|''Scriptlog\Core\ApiAuth'']] | | | ''ApiAuth'' | [[scriptlog:lib:core:apiauth|''Scriptlog\Core\ApiAuth'']] | |
| | ''ApiHelper'' | [[scriptlog:lib:core:apihelper|''Scriptlog\Core\ApiHelper'']] | | | ''ApiHelper'' | [[scriptlog:lib:core:apihelper|''Scriptlog\Core\ApiHelper'']] | |
| | ''ApiHateoas'' | [[scriptlog:lib:core:apihateoas|''Scriptlog\Core\ApiHateoas'']] | | | ''ApiHateoas'' | [[scriptlog:lib:core:apihateoas|''Scriptlog\Core\ApiHateoas'']] | |
| | ''ApiResponse'' | [[scriptlog:lib:core:apiresponse|''Scriptlog\Core\ApiResponse'']] | | | ''ApiResponse'' | [[scriptlog:lib:core:apiresponse|''Scriptlog\Core\ApiResponse'']] | |
| |
| |