src/Repositories/RoleRepository.php
public function getMultipleByName(array $roles): iterable
    {
        if (null === $this->roles) {
            $this->getAll();
        }

        $results = [];

        foreach ($roles as $role) {
            if (isset($this->names[$role])) {
                $results[] = $this->roles[$this->names[$role]];
            }
        }

        return $results;
    }
public function getMultipleByName(array $roles): iterable
    {
        if (null === $this->roles) {
            $this->getAll();
        }

        $results = [];

        foreach ($roles as $role) {
            if (isset($this->names[$role])) {
                $results[] = $this->roles[$this->names[$role]];
            }
        }

        return $results;
    }
public function getMultipleByName ( array $ roles ) : iterable { if ( null === $ this -> roles ) { $ this -> getAll ( ) ; } $ results = [ ] ; foreach ( $ roles as $ role ) { if ( isset ( $ this -> names [ $ role ] ) ) { $ results [ ] = $ this -> roles [ $ this -> names [ $ role ] ] ; } } return $ results ; }
Get roles by their names

@param string[] $roles
@return iterable|IRole[]
Get roles by their names