Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
4 / 4
CRAP
100.00% covered (success)
100.00%
1 / 1
AuditableModel
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
4 / 4
4
100.00% covered (success)
100.00%
1 / 1
 setAuditor
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getAuditor
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 hasAuditor
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 isAuditable
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2/**
3 * Pop PHP Framework (http://www.popphp.org/)
4 *
5 * @link       https://github.com/popphp/popphp-framework
6 * @author     Nick Sagona, III <dev@nolainteractive.com>
7 * @copyright  Copyright (c) 2009-2024 NOLA Interactive, LLC. (http://www.nolainteractive.com)
8 * @license    http://www.popphp.org/license     New BSD License
9 */
10
11/**
12 * @namespace
13 */
14namespace Pop\Audit\Model;
15
16use Pop\Audit\Auditor;
17use Pop\Model\AbstractDataModel;
18
19/**
20 * Abstract auditable model class
21 *
22 * @category   Pop
23 * @package    Pop\Audit
24 * @author     Nick Sagona, III <dev@nolainteractive.com>
25 * @copyright  Copyright (c) 2009-2024 NOLA Interactive, LLC. (http://www.nolainteractive.com)
26 * @license    http://www.popphp.org/license     New BSD License
27 * @version    2.0.0
28 */
29abstract class AuditableModel extends AbstractDataModel implements AuditableInterface
30{
31
32    /**
33     * Auditor object
34     * @var ?Auditor
35     */
36    protected ?Auditor $auditor = null;
37
38    /**
39     * Set the auditor object
40     *
41     * @param  Auditor $auditor
42     * @return AuditableModel
43     */
44    public function setAuditor(Auditor $auditor): AuditableModel
45    {
46        $this->auditor = $auditor;
47        return $this;
48    }
49
50    /**
51     * Get the auditor object
52     *
53     * @return Auditor|null
54     */
55    public function getAuditor(): Auditor|null
56    {
57        return $this->auditor;
58    }
59
60    /**
61     * Determine if the model has auditor
62     *
63     * @return bool
64     */
65    public function hasAuditor(): bool
66    {
67        return ($this->auditor !== null);
68    }
69
70    /**
71     * Determine if the model is auditable (alias)
72     *
73     * @return bool
74     */
75    public function isAuditable(): bool
76    {
77        return ($this->auditor !== null);
78    }
79
80}