Email.php
public function __async_register()
    {
        $result = array('status' => '0');

        // Check if email field is passed
        if (!isset($_POST[$this->dbEmailField])) {
            $result[self::RESPONSE_ERROR_FIELD] = "\n".'['.$this->dbEmailField.'] field is not passed';
        }

        // Check if hashed password field is passed
        if (!isset($_POST[$this->dbHashPasswordField])) {
            $result[self::RESPONSE_ERROR_FIELD] = "\n".'['.$this->dbHashPasswordField.'] field is not passed';
        } else { // Rehash password
            $_POST[$this->dbHashPasswordField] = $this->hash($_POST[$this->dbHashPasswordField]);
        }

        // If we have all data needed
        if (isset($_POST[$this->dbHashPasswordField]) && isset($_POST[$this->dbEmailField])) {

            /**@var EmailStatus $registerResult Perform generic registration*/
            $registerResult = $this->register($_POST[$this->dbEmailField], $_POST[$this->dbHashPasswordField]);

            // Check if it was successfull
            if ($registerResult->code == EmailStatus::SUCCESS_EMAIL_REGISTERED) {
                $result['status'] = '1';
            }

            // Save email register status
            $result[self::RESPONSE_STATUS_TEXTFIELD] = $registerResult->text;
            $result[self::RESPONSE_STATUS_FIELD] = $registerResult->code;
            $result = array_merge($result, $registerResult->response);
        }

        return $result;
    }
public function __async_register()
    {
        $result = array('status' => '0');

        // Check if email field is passed
        if (!isset($_POST[$this->dbEmailField])) {
            $result[self::RESPONSE_ERROR_FIELD] = "\n".'['.$this->dbEmailField.'] field is not passed';
        }

        // Check if hashed password field is passed
        if (!isset($_POST[$this->dbHashPasswordField])) {
            $result[self::RESPONSE_ERROR_FIELD] = "\n".'['.$this->dbHashPasswordField.'] field is not passed';
        } else { // Rehash password
            $_POST[$this->dbHashPasswordField] = $this->hash($_POST[$this->dbHashPasswordField]);
        }

        // If we have all data needed
        if (isset($_POST[$this->dbHashPasswordField]) && isset($_POST[$this->dbEmailField])) {

            /**@var EmailStatus $registerResult Perform generic registration*/
            $registerResult = $this->register($_POST[$this->dbEmailField], $_POST[$this->dbHashPasswordField]);

            // Check if it was successfull
            if ($registerResult->code == EmailStatus::SUCCESS_EMAIL_REGISTERED) {
                $result['status'] = '1';
            }

            // Save email register status
            $result[self::RESPONSE_STATUS_TEXTFIELD] = $registerResult->text;
            $result[self::RESPONSE_STATUS_FIELD] = $registerResult->code;
            $result = array_merge($result, $registerResult->response);
        }

        return $result;
    }
public function __async_register ( ) { $ result = array ( 'status' => '0' ) ; // Check if email field is passed if ( ! isset ( $ _POST [ $ this -> dbEmailField ] ) ) { $ result [ self :: RESPONSE_ERROR_FIELD ] = "\n" . '[' . $ this -> dbEmailField . '] field is not passed' ; } // Check if hashed password field is passed if ( ! isset ( $ _POST [ $ this -> dbHashPasswordField ] ) ) { $ result [ self :: RESPONSE_ERROR_FIELD ] = "\n" . '[' . $ this -> dbHashPasswordField . '] field is not passed' ; } else { // Rehash password $ _POST [ $ this -> dbHashPasswordField ] = $ this -> hash ( $ _POST [ $ this -> dbHashPasswordField ] ) ; } // If we have all data needed if ( isset ( $ _POST [ $ this -> dbHashPasswordField ] ) && isset ( $ _POST [ $ this -> dbEmailField ] ) ) { /**@var EmailStatus $registerResult Perform generic registration*/ $ registerResult = $ this -> register ( $ _POST [ $ this -> dbEmailField ] , $ _POST [ $ this -> dbHashPasswordField ] ) ; // Check if it was successfull if ( $ registerResult -> code == EmailStatus :: SUCCESS_EMAIL_REGISTERED ) { $ result [ 'status' ] = '1' ; } // Save email register status $ result [ self :: RESPONSE_STATUS_TEXTFIELD ] = $ registerResult -> text ; $ result [ self :: RESPONSE_STATUS_FIELD ] = $ registerResult -> code ; $ result = array_merge ( $ result , $ registerResult -> response ) ; } return $ result ; }
Generic universal asynchronous registration controller
method expects that all necessary registration data(email, hashed password)
would be passed via $_POST.

@return array Asynchronous response array
Generic universal asynchronous registration controller method expects that all necessary registration data ( email hashed password ) would be passed via $_POST .