@@ 15-32 (lines=18) @@ | ||
12 | /** |
|
13 | * @param array|string $actions |
|
14 | */ |
|
15 | public function __construct($actions) |
|
16 | { |
|
17 | if ( ! is_array($actions)) { |
|
18 | $actions = (array)$actions; |
|
19 | } |
|
20 | ||
21 | foreach ($actions as $action) { |
|
22 | if ($action === '*') { |
|
23 | continue; |
|
24 | } |
|
25 | ||
26 | if (strpos($action, ':') === false) { |
|
27 | throw new \InvalidArgumentException('Invalid service prefix for action "' . $action . '".'); |
|
28 | } |
|
29 | } |
|
30 | ||
31 | $this->actions = $actions; |
|
32 | } |
|
33 | ||
34 | /** |
|
35 | * @return array |
@@ 17-34 (lines=18) @@ | ||
14 | /** |
|
15 | * @param array|string $resources |
|
16 | */ |
|
17 | public function __construct($resources) |
|
18 | { |
|
19 | if ( ! is_array($resources)) { |
|
20 | $resources = (array)$resources; |
|
21 | } |
|
22 | ||
23 | foreach ($resources as $resource) { |
|
24 | if ($resource === '*') { |
|
25 | continue; |
|
26 | } |
|
27 | ||
28 | if (strpos($resource, self::$prefix . ':') !== 0) { |
|
29 | throw new \InvalidArgumentException('Invalid resource "' . $resource . '".'); |
|
30 | } |
|
31 | } |
|
32 | ||
33 | $this->resources = $resources; |
|
34 | } |
|
35 | ||
36 | /** |
|
37 | * @return array |