This is an old revision of the document!
Table of Contents
ConsentService
Layer: Service · Source: lib/service/ConsentService.php:22 (lines 22–178)
class ConsentService
Business logic for consent management
Docblock Metadata
| Tag | Value |
|---|---|
@category | Service class |
@author | Scriptlog |
@license | MIT |
@version | 1.0 |
@since | Since Release 1.0 |
Inheritance
No parent, interface or trait. This is a root type.
Constants (0)
None.
Properties (0)
None declared.
Methods (9)
| Visibility | Method | Summary | Line |
|---|---|---|---|
| public | __construct() | Constructor | 59 |
| public | recordConsent() | Record user consent | 73 |
| public | updateConsent() | Update user consent | 95 |
| public | getLatestConsent() | Get latest consent by type | 106 |
| public | getAllConsents() | Get all consent records | 116 |
| public | hasConsented() | Check if user has given consent | 131 |
| public | processCookieConsent() | Process cookie consent from user | 142 |
| public | isCookieConsentAccepted() | Get cookie consent status | 157 |
| public | cleanOldConsents() | Clean old consent records | 174 |
__construct()
public function __construct(ConsentDao $consentDao)
lines 59–62 (4)
Constructor
| Parameter | Type | Default | Description |
|---|---|---|---|
$consentDao | ''ConsentDao'' | required | none |
recordConsent()
public function recordConsent($consentType, $consentStatus, $ipAddress, $userAgent = null)
lines 73–86 (14)
Record user consent
| Parameter | Type | Default | Description |
|---|---|---|---|
$consentType | (untyped) | required | none |
$consentStatus | (untyped) | required | none |
$ipAddress | (untyped) | required | none |
$userAgent | (untyped) | null | none |
Returns: (none declared) — int|bool
updateConsent()
public function updateConsent($consentId, $consentStatus)
lines 95–98 (4)
Update user consent
| Parameter | Type | Default | Description |
|---|---|---|---|
$consentId | (untyped) | required | none |
$consentStatus | (untyped) | required | none |
Returns: (none declared) — bool
getLatestConsent()
public function getLatestConsent($consentType)
lines 106–109 (4)
Get latest consent by type
| Parameter | Type | Default | Description |
|---|---|---|---|
$consentType | (untyped) | required | none |
Returns: (none declared) — array|bool
getAllConsents()
public function getAllConsents()
lines 116–119 (4)
Get all consent records
Takes no parameters.
Returns: (none declared) — array|bool
hasConsented()
public function hasConsented($consentType, $ipAddress = null)
lines 131–134 (4)
Check if user has given consent
Consent is evaluated per visitor when an IP address is provided; without one the check falls back to the site-global record (legacy).
| Parameter | Type | Default | Description |
|---|---|---|---|
$consentType | (untyped) | required | none |
$ipAddress | (untyped) | null | none |
Returns: (none declared) — bool
processCookieConsent()
public function processCookieConsent($status)
lines 142–150 (9)
Process cookie consent from user
| Parameter | Type | Default | Description |
|---|---|---|---|
$status | (untyped) | required | 'accepted' or 'rejected' |
Returns: (none declared) — bool
isCookieConsentAccepted()
public function isCookieConsentAccepted()
lines 157–166 (10)
Get cookie consent status
Takes no parameters.
Returns: (none declared) — bool
cleanOldConsents()
public function cleanOldConsents($days = 365)
lines 174–177 (4)
Clean old consent records
| Parameter | Type | Default | Description |
|---|---|---|---|
$days | (untyped) | 365 | none |
Returns: (none declared) — bool
Imports
| Alias | Fully-qualified name |
|---|---|
ConsentDao | ''Scriptlog\Dao\ConsentDao'' |
This page is generated from source by 'tools/gendoc'. Edits will be overwritten.
