All filters rewritten to throw FilterChainException
[core.git] / inc / classes / main / filter / validator / class_EmailValidatorFilter.php
index fe09faa..9dabfc3 100644 (file)
@@ -54,6 +54,7 @@ class EmailValidatorFilter extends BaseFilter implements Filterable {
         * @param       $requestInstance        An instance of a class with an Requestable interface
         * @param       $responseInstance       An instance of a class with an Responseable interface
         * @return      void
+        * @throws      FilterChainException    If this filter fails to operate
         */
        public function execute (Requestable $requestInstance, Responseable $responseInstance) {
                // Get Email from request
@@ -74,7 +75,7 @@ class EmailValidatorFilter extends BaseFilter implements Filterable {
                                $responseInstance->addFatalMessage('email_unset');
 
                                // Abort here
-                               return false;
+                               throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED);
                        } elseif ((empty($email1)) || (empty($email2))) {
                                // Email is empty
                                $requestInstance->requestIsValid(false);
@@ -92,7 +93,7 @@ class EmailValidatorFilter extends BaseFilter implements Filterable {
                                } // END - if
 
                                // Abort here
-                               return false;
+                               throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED);
                        } elseif ($this->ifEmailIsTaken($email1)) {
                                // Email is already taken
                                $requestInstance->requestIsValid(false);
@@ -101,7 +102,7 @@ class EmailValidatorFilter extends BaseFilter implements Filterable {
                                $responseInstance->addFatalMessage('email_taken');
 
                                // Abort here
-                               return false;
+                               throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED);
                        } elseif ($email1 != $email2) {
                                // Emails didn't match
                                $requestInstance->requestIsValid(false);
@@ -110,7 +111,7 @@ class EmailValidatorFilter extends BaseFilter implements Filterable {
                                $responseInstance->addFatalMessage('emails_mismatch');
 
                                // Abort here
-                               return false;
+                               throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED);
                        } // END - elseif
                } elseif (empty($email)) {
                        // Empty field!
@@ -120,7 +121,7 @@ class EmailValidatorFilter extends BaseFilter implements Filterable {
                        $responseInstance->addFatalMessage('email_empty');
 
                        // Abort here
-                       return false;
+                       throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED);
                } // END - elseif
        }