public function getItems(): array
    {
        $available = [];
        $assigned = [];

        if ($this->type == Item::TYPE_ROLE) {
            foreach (array_keys($this->manager->getRoles()) as $name) {
                $available[$name] = 'role';
            }
        }
        foreach (array_keys($this->manager->getPermissions()) as $name) {
            $available[$name] = $name[0] == '/' ? 'route' : 'permission';
        }

        foreach ($this->manager->getChildren($this->_item->name) as $item) {
            $assigned[$item->name] = $item->type == 1 ? 'role' : ($item->name[0] == '/' ? 'route' : 'permission');
            unset($available[$item->name]);
        }

        unset($available[$this->name]);

        return [
            'available' => $available,
            'assigned' => $assigned,
        ];
    }
public function getItems(): array
    {
        $available = [];
        $assigned = [];

        if ($this->type == Item::TYPE_ROLE) {
            foreach (array_keys($this->manager->getRoles()) as $name) {
                $available[$name] = 'role';
            }
        }
        foreach (array_keys($this->manager->getPermissions()) as $name) {
            $available[$name] = $name[0] == '/' ? 'route' : 'permission';
        }

        foreach ($this->manager->getChildren($this->_item->name) as $item) {
            $assigned[$item->name] = $item->type == 1 ? 'role' : ($item->name[0] == '/' ? 'route' : 'permission');
            unset($available[$item->name]);
        }

        unset($available[$this->name]);

        return [
            'available' => $available,
            'assigned' => $assigned,
        ];
    }
public function getItems ( ) : array { $ available = [ ] ; $ assigned = [ ] ; if ( $ this -> type == Item :: TYPE_ROLE ) { foreach ( array_keys ( $ this -> manager -> getRoles ( ) ) as $ name ) { $ available [ $ name ] = 'role' ; } } foreach ( array_keys ( $ this -> manager -> getPermissions ( ) ) as $ name ) { $ available [ $ name ] = $ name [ 0 ] == '/' ? 'route' : 'permission' ; } foreach ( $ this -> manager -> getChildren ( $ this -> _item -> name ) as $ item ) { $ assigned [ $ item -> name ] = $ item -> type == 1 ? 'role' : ( $ item -> name [ 0 ] == '/' ? 'route' : 'permission' ) ; unset ( $ available [ $ item -> name ] ) ; } unset ( $ available [ $ this -> name ] ) ; return [ 'available' => $ available , 'assigned' => $ assigned , ] ; }
Get all available and assigned roles, permission and routes

@return array
Get all available and assigned roles permission and routes