public function setRoles(array $roles)
    {
        $this->roleIdentifiers = [];
        $this->roles = [];
        foreach ($roles as $role) {
            if (!$role instanceof Role) {
                throw new \InvalidArgumentException(sprintf('setRoles() only accepts an array of %s instances, given: "%s"', Role::class, gettype($role)), 1397125997);
            }
            $this->addRole($role);
        }
    }
public function setRoles(array $roles)
    {
        $this->roleIdentifiers = [];
        $this->roles = [];
        foreach ($roles as $role) {
            if (!$role instanceof Role) {
                throw new \InvalidArgumentException(sprintf('setRoles() only accepts an array of %s instances, given: "%s"', Role::class, gettype($role)), 1397125997);
            }
            $this->addRole($role);
        }
    }
public function setRoles ( array $ roles ) { $ this -> roleIdentifiers = [ ] ; $ this -> roles = [ ] ; foreach ( $ roles as $ role ) { if ( ! $ role instanceof Role ) { throw new \ InvalidArgumentException ( sprintf ( 'setRoles() only accepts an array of %s instances, given: "%s"' , Role :: class , gettype ( $ role ) ) , 1397125997 ) ; } $ this -> addRole ( $ role ) ; } }
Sets the roles for this account

@param array<Role> $roles An array of Policy\Role objects
@return void
@throws \InvalidArgumentException
@api
Sets the roles for this account