public function validateUsernameOrEmail($username)
    {
        $username = trim($username);
        if (!strlen($username) || (!filter_var($username, FILTER_VALIDATE_EMAIL) && !$this->validateUsername($username))) {
            throw new \RuntimeException(
                'Please enter a valid email address or username.'
            );
        }

        return $username;
    }
public function validateUsernameOrEmail($username)
    {
        $username = trim($username);
        if (!strlen($username) || (!filter_var($username, FILTER_VALIDATE_EMAIL) && !$this->validateUsername($username))) {
            throw new \RuntimeException(
                'Please enter a valid email address or username.'
            );
        }

        return $username;
    }
public function validateUsernameOrEmail ( $ username ) { $ username = trim ( $ username ) ; if ( ! strlen ( $ username ) || ( ! filter_var ( $ username , FILTER_VALIDATE_EMAIL ) && ! $ this -> validateUsername ( $ username ) ) ) { throw new \ RuntimeException ( 'Please enter a valid email address or username.' ) ; } return $ username ; }
Validation callback for the username or email address.

@param string $username

@return string
Validation callback for the username or email address .