src/logic/PhoneConfirmer.php
public function submitCode()
    {
        if (!$this->model->validate()) {
            throw new PhoneConfirmationException('Form validation failed');
        }

        try {
            Contact::perform('confirm-phone', [
                'id' => $this->model->id,
                'type' => $this->model->type,
                'phone' => $this->model->phone,
                'code' => $this->model->code,
            ]);
        } catch (ResponseErrorException $e) {
            if ($e->getMessage() === 'wrong code') {
                throw new PhoneConfirmationException(Yii::t('hipanel:client', 'Wrong confirmation code'));
            }

            throw new PhoneConfirmationException($e->getMessage());
        }

        return true;
    }
public function submitCode()
    {
        if (!$this->model->validate()) {
            throw new PhoneConfirmationException('Form validation failed');
        }

        try {
            Contact::perform('confirm-phone', [
                'id' => $this->model->id,
                'type' => $this->model->type,
                'phone' => $this->model->phone,
                'code' => $this->model->code,
            ]);
        } catch (ResponseErrorException $e) {
            if ($e->getMessage() === 'wrong code') {
                throw new PhoneConfirmationException(Yii::t('hipanel:client', 'Wrong confirmation code'));
            }

            throw new PhoneConfirmationException($e->getMessage());
        }

        return true;
    }
public function submitCode ( ) { if ( ! $ this -> model -> validate ( ) ) { throw new PhoneConfirmationException ( 'Form validation failed' ) ; } try { Contact :: perform ( 'confirm-phone' , [ 'id' => $ this -> model -> id , 'type' => $ this -> model -> type , 'phone' => $ this -> model -> phone , 'code' => $ this -> model -> code , ] ) ; } catch ( ResponseErrorException $ e ) { if ( $ e -> getMessage ( ) === 'wrong code' ) { throw new PhoneConfirmationException ( Yii :: t ( 'hipanel:client' , 'Wrong confirmation code' ) ) ; } throw new PhoneConfirmationException ( $ e -> getMessage ( ) ) ; } return true ; }
Sends the phone number confirmation code to the API.

@throws PhoneConfirmationException
@return bool whether code was submitted successfully
Sends the phone number confirmation code to the API .