| Conditions | 5 |
| Paths | 8 |
| Total Lines | 16 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 32 | 13 | public function init(AuthManager $auth) |
|
| 33 | { |
||
| 34 | 13 | foreach (array_keys($this->getTree()) as $role) { |
|
| 35 | 13 | $auth->setRole($role); |
|
| 36 | } |
||
| 37 | |||
| 38 | 13 | foreach ($this->getTree() as $role => $items) { |
|
| 39 | 13 | foreach ($items as $name) { |
|
| 40 | 13 | $item = $auth->getItem($name); |
|
| 41 | 13 | if ($item === null) { |
|
| 42 | 13 | $item = $auth->setPermission($name); |
|
| 43 | } |
||
| 44 | 13 | $auth->setChild($role, $item); |
|
| 45 | } |
||
| 46 | } |
||
| 47 | 13 | } |
|
| 48 | |||
| 58 |