protected function getAudibleCode()
    {
        $letters = array();
        $code    = $this->getCode(true, true);

        if (empty($code) || empty($code['code'])) {
            if (strlen($this->display_value) > 0) {
                $code = array('code' => $this->display_value, 'display' => $this->display_value);
            } else {
                $this->createCode();
                $code = $this->getCode(true);
            }
        }

        if (empty($code)) {
            $error = 'Failed to get audible code (are database settings correct?).  Check the error log for details';
            trigger_error($error, E_USER_WARNING);
            throw new \Exception($error);
        }

        if (preg_match('/(\d+) (\+|-|x) (\d+)/i', $code['display'], $eq)) {
            $math = true;

            $left  = $eq[1];
            $sign  = str_replace(array('+', '-', 'x'), array('plus', 'minus', 'times'), $eq[2]);
            $right = $eq[3];

            $letters = array($left, $sign, $right);
        } else {
            $math = false;

            $length = $this->strlen($code['display']);

            for($i = 0; $i < $length; ++$i) {
                $letter    = $this->substr($code['display'], $i, 1);
                $letters[] = $letter;
            }
        }

        try {
            return $this->generateWAV($letters);
        } catch(\Exception $ex) {
            throw $ex;
        }
    }
protected function getAudibleCode()
    {
        $letters = array();
        $code    = $this->getCode(true, true);

        if (empty($code) || empty($code['code'])) {
            if (strlen($this->display_value) > 0) {
                $code = array('code' => $this->display_value, 'display' => $this->display_value);
            } else {
                $this->createCode();
                $code = $this->getCode(true);
            }
        }

        if (empty($code)) {
            $error = 'Failed to get audible code (are database settings correct?).  Check the error log for details';
            trigger_error($error, E_USER_WARNING);
            throw new \Exception($error);
        }

        if (preg_match('/(\d+) (\+|-|x) (\d+)/i', $code['display'], $eq)) {
            $math = true;

            $left  = $eq[1];
            $sign  = str_replace(array('+', '-', 'x'), array('plus', 'minus', 'times'), $eq[2]);
            $right = $eq[3];

            $letters = array($left, $sign, $right);
        } else {
            $math = false;

            $length = $this->strlen($code['display']);

            for($i = 0; $i < $length; ++$i) {
                $letter    = $this->substr($code['display'], $i, 1);
                $letters[] = $letter;
            }
        }

        try {
            return $this->generateWAV($letters);
        } catch(\Exception $ex) {
            throw $ex;
        }
    }
protected function getAudibleCode ( ) { $ letters = array ( ) ; $ code = $ this -> getCode ( true , true ) ; if ( empty ( $ code ) || empty ( $ code [ 'code' ] ) ) { if ( strlen ( $ this -> display_value ) > 0 ) { $ code = array ( 'code' => $ this -> display_value , 'display' => $ this -> display_value ) ; } else { $ this -> createCode ( ) ; $ code = $ this -> getCode ( true ) ; } } if ( empty ( $ code ) ) { $ error = 'Failed to get audible code (are database settings correct?).  Check the error log for details' ; trigger_error ( $ error , E_USER_WARNING ) ; throw new \ Exception ( $ error ) ; } if ( preg_match ( '/(\d+) (\+|-|x) (\d+)/i' , $ code [ 'display' ] , $ eq ) ) { $ math = true ; $ left = $ eq [ 1 ] ; $ sign = str_replace ( array ( '+' , '-' , 'x' ) , array ( 'plus' , 'minus' , 'times' ) , $ eq [ 2 ] ) ; $ right = $ eq [ 3 ] ; $ letters = array ( $ left , $ sign , $ right ) ; } else { $ math = false ; $ length = $ this -> strlen ( $ code [ 'display' ] ) ; for ( $ i = 0 ; $ i < $ length ; ++ $ i ) { $ letter = $ this -> substr ( $ code [ 'display' ] , $ i , 1 ) ; $ letters [ ] = $ letter ; } } try { return $ this -> generateWAV ( $ letters ) ; } catch ( \ Exception $ ex ) { throw $ ex ; } }
Generates an audio captcha in WAV format

@return string The audio representation of the captcha in Wav format
Generates an audio captcha in WAV format