Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
4 / 4
CRAP
100.00% covered (success)
100.00%
1 / 1
AbstractAcl
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
4 / 4
4
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 setName
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getName
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 __toString
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2declare(strict_types=1);
3/**
4 * Pop PHP Framework (https://www.popphp.org/)
5 *
6 * @link       https://github.com/popphp/popphp-framework
7 * @author     Nick Sagona, III <nick@popphp.org>
8 * @copyright  Copyright (c) 2009-2026 Nick Sagona, III
9 * @license    https://www.popphp.org/license     New BSD License
10 */
11
12/**
13 * @namespace
14 */
15namespace Pop\Acl;
16
17use Pop\Utils;
18use Pop\Utils\Exception;
19
20/**
21 * Abstract ACL role class
22 *
23 * @category   Pop
24 * @package    Pop\Acl
25 * @author     Nick Sagona, III <nick@popphp.org>
26 * @copyright  Copyright (c) 2009-2026 Nick Sagona, III
27 * @license    https://www.popphp.org/license     New BSD License
28 * @version    5.0.0
29 */
30abstract class AbstractAcl extends Utils\ArrayObject
31{
32
33    /**
34     * Role name
35     * @var ?string
36     */
37    protected ?string $name = null;
38
39    /**
40     * Constructor
41     *
42     * Instantiate the acl role object
43     *
44     * @param  string $name
45     * @param  array $data
46     * @throws Exception
47     */
48    public function __construct(string $name, array $data = [])
49    {
50        $this->setName($name);
51        parent::__construct($data);
52    }
53
54    /**
55     * Set the acl role name
56     *
57     * @param  string $name
58     * @return AbstractAcl
59     */
60    public function setName(string $name): AbstractAcl
61    {
62        $this->name = $name;
63        return $this;
64    }
65
66    /**
67     * Get the acl role name
68     *
69     * @return string|null
70     */
71    public function getName(): string|null
72    {
73        return $this->name;
74    }
75
76    /**
77     * Return the string value of the name of the acl role
78     *
79     * @return string
80     */
81    public function __toString(): string
82    {
83        return $this->name;
84    }
85
86}