public function setRoles(array $roles) {
		
		$this->roles = [];
		
		foreach($roles as $role) {

			if(!$role instanceof Role) {
				throw new \InvalidArgumentException('Role is not a role instance.');
			}
			if(array_key_exists($role->getRoleName(), $this->roles)) {
				throw new \InvalidArgumentException(sprintf("Role '%s' defined twice.", $role->getRoleName()));
			}

			$this->roles[$role->getRoleName()] = $role;

		}

		return $this;
	}
public function setRoles(array $roles) {
		
		$this->roles = [];
		
		foreach($roles as $role) {

			if(!$role instanceof Role) {
				throw new \InvalidArgumentException('Role is not a role instance.');
			}
			if(array_key_exists($role->getRoleName(), $this->roles)) {
				throw new \InvalidArgumentException(sprintf("Role '%s' defined twice.", $role->getRoleName()));
			}

			$this->roles[$role->getRoleName()] = $role;

		}

		return $this;
	}
public function setRoles ( array $ roles ) { $ this -> roles = [ ] ; foreach ( $ roles as $ role ) { if ( ! $ role instanceof Role ) { throw new \ InvalidArgumentException ( 'Role is not a role instance.' ) ; } if ( array_key_exists ( $ role -> getRoleName ( ) , $ this -> roles ) ) { throw new \ InvalidArgumentException ( sprintf ( "Role '%s' defined twice." , $ role -> getRoleName ( ) ) ) ; } $ this -> roles [ $ role -> getRoleName ( ) ] = $ role ; } return $ this ; }
set all roles of user

@param Role[]
@throws \InvalidArgumentException
@return \vxPHP\User\User
set all roles of user