public static function validEmail($value)
    {
        if (is_object($value) || empty($value)) {
            throw new \InvalidArgumentException("Empty email given.");
        }

        if (!filter_var((string)$value, FILTER_VALIDATE_EMAIL)) {
            throw new \InvalidArgumentException("Invalid email address given.");
        }

        return $value;
    }
public static function validEmail($value)
    {
        if (is_object($value) || empty($value)) {
            throw new \InvalidArgumentException("Empty email given.");
        }

        if (!filter_var((string)$value, FILTER_VALIDATE_EMAIL)) {
            throw new \InvalidArgumentException("Invalid email address given.");
        }

        return $value;
    }
public static function validEmail ( $ value ) { if ( is_object ( $ value ) || empty ( $ value ) ) { throw new \ InvalidArgumentException ( "Empty email given." ) ; } if ( ! filter_var ( ( string ) $ value , FILTER_VALIDATE_EMAIL ) ) { throw new \ InvalidArgumentException ( "Invalid email address given." ) ; } return $ value ; }
Validates the given value using the PHP filter_var
with FILTER_VALIDATE_EMAIL option.

@param string $value value to check

@return string email

@throws \InvalidArgumentException in case of validation errors (invalid or empty email)
Validates the given value using the PHP filter_var with FILTER_VALIDATE_EMAIL option .