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