| @@ 88-106 (lines=19) @@ | ||
| 85 | * @throws InvalidArgumentException If the passed arguments is not an array, null, or a comma-separated string. |
|
| 86 | * @return AclRole Chainable |
|
| 87 | */ |
|
| 88 | public function setAllowed($allowed) |
|
| 89 | { |
|
| 90 | if ($allowed === null) { |
|
| 91 | $this->allowed = null; |
|
| 92 | return $this; |
|
| 93 | } |
|
| 94 | ||
| 95 | if (is_string($allowed)) { |
|
| 96 | $allowed = explode(self::SEPARATOR, $allowed); |
|
| 97 | $allowed = array_walk('trim', $allowed); |
|
| 98 | } |
|
| 99 | if (!is_array($allowed)) { |
|
| 100 | throw new InvalidArgumentException( |
|
| 101 | 'Invalid allowed value. Must be an array, null, or a comma-separated string.' |
|
| 102 | ); |
|
| 103 | } |
|
| 104 | $this->allowed = $allowed; |
|
| 105 | return $this; |
|
| 106 | } |
|
| 107 | ||
| 108 | /** |
|
| 109 | * @return string[]|null |
|
| @@ 121-139 (lines=19) @@ | ||
| 118 | * @throws InvalidArgumentException If the passed arguments is not an array, null, or a comma-separated string. |
|
| 119 | * @return AclRole Chainable |
|
| 120 | */ |
|
| 121 | public function setDenied($denied) |
|
| 122 | { |
|
| 123 | if ($denied === null) { |
|
| 124 | $this->denied = null; |
|
| 125 | return $this; |
|
| 126 | } |
|
| 127 | ||
| 128 | if (is_string($denied)) { |
|
| 129 | $denied = explode(self::SEPARATOR, $denied); |
|
| 130 | $denied = array_walk('trim', $denied); |
|
| 131 | } |
|
| 132 | if (!is_array($denied)) { |
|
| 133 | throw new InvalidArgumentException( |
|
| 134 | 'Invalid denied value. Must be an array, null, or a comma-separated string.' |
|
| 135 | ); |
|
| 136 | } |
|
| 137 | $this->denied = $denied; |
|
| 138 | return $this; |
|
| 139 | } |
|
| 140 | ||
| 141 | /** |
|
| 142 | * @return string[]|null |
|