Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
CookieConsent
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 3
12
0.00% covered (danger)
0.00%
0 / 1
 hasAnalyticsConsent
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 hasFunctionalConsent
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 hasMarketingConsent
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2declare(strict_types=1);
3
4namespace App\Model\Entity;
5
6use Cake\ORM\Entity;
7
8/**
9 * CookieConsent Entity
10 *
11 * @property string $id
12 * @property int|null $user_id
13 * @property string|null $session_id
14 * @property bool $analytics_consent
15 * @property bool $functional_consent
16 * @property bool $marketing_consent
17 * @property bool $essential_consent
18 * @property string $ip_address
19 * @property string $user_agent
20 * @property \Cake\I18n\DateTime|null $created
21 * @property \Cake\I18n\DateTime|null $updated
22 *
23 * @property \App\Model\Entity\User $user
24 */
25class CookieConsent extends Entity
26{
27    /**
28     * Fields that can be mass assigned using newEntity() or patchEntity().
29     *
30     * Note that when '*' is set to true, this allows all unspecified fields to
31     * be mass assigned. For security purposes, it is advised to set '*' to false
32     * (or remove it), and explicitly make individual fields accessible as needed.
33     *
34     * @var array<string, bool>
35     */
36    protected array $_accessible = [
37        'user_id' => true,
38        'session_id' => true,
39        'analytics_consent' => true,
40        'functional_consent' => true,
41        'marketing_consent' => true,
42        'essential_consent' => true,
43        'ip_address' => true,
44        'user_agent' => true,
45        'created' => true,
46        'updated' => true,
47    ];
48
49    /**
50     * Check if analytics cookies are allowed.
51     *
52     * @return bool
53     */
54    public function hasAnalyticsConsent(): bool
55    {
56        return (bool)$this->analytics_consent;
57    }
58
59    /**
60     * Check if functional cookies are allowed.
61     *
62     * @return bool
63     */
64    public function hasFunctionalConsent(): bool
65    {
66        return (bool)$this->functional_consent;
67    }
68
69    /**
70     * Check if marketing cookies are allowed.
71     *
72     * @return bool
73     */
74    public function hasMarketingConsent(): bool
75    {
76        return (bool)$this->marketing_consent;
77    }
78}