protected function handleMsg()
    {
        switch ($this->getMsgType()) {
            case 'text':
                if ($result = $this->handleText()) {
                    return $result;
                }
                break;

            case 'event':
            case 'device_event':
                $event = strtolower($this->getEvent());
                switch ($event) {
                    case 'subscribe':
                        $result = $this->handleEvent('subscribe');
                        $scanResult = null;
                        if ($this->getTicket()) {
                            $scanResult = $this->handleEvent('scan');
                        }
                        if ($result) {
                            return $result;
                        }
                        if ($scanResult) {
                            return $scanResult;
                        }
                        break;

                    case 'scan':
                        if ($result = $this->handleEvent('scan')) {
                            return $result;
                        }
                        break;

                    default:
                        if ($result = $this->handleEvent($event, $this->getEventKey())) {
                            return $result;
                        }
                        break;
                }
                break;

            // Including location, image, voice, video and link
            default:
                if (isset($this->rules[$this->getMsgType()])) {
                    return $this->handle($this->rules[$this->getMsgType()]);
                }
        }

        // Check if enable to transfer to customer service
        if (isset($this->rules['transferCustomer'])) {
            return $this->handle($this->rules['transferCustomer']);
        }

        // Fallback to the default rule
        if (!$this->handled && $this->defaults) {
            return $this->handle($this->defaults);
        }

        return false;
    }
protected function handleMsg()
    {
        switch ($this->getMsgType()) {
            case 'text':
                if ($result = $this->handleText()) {
                    return $result;
                }
                break;

            case 'event':
            case 'device_event':
                $event = strtolower($this->getEvent());
                switch ($event) {
                    case 'subscribe':
                        $result = $this->handleEvent('subscribe');
                        $scanResult = null;
                        if ($this->getTicket()) {
                            $scanResult = $this->handleEvent('scan');
                        }
                        if ($result) {
                            return $result;
                        }
                        if ($scanResult) {
                            return $scanResult;
                        }
                        break;

                    case 'scan':
                        if ($result = $this->handleEvent('scan')) {
                            return $result;
                        }
                        break;

                    default:
                        if ($result = $this->handleEvent($event, $this->getEventKey())) {
                            return $result;
                        }
                        break;
                }
                break;

            // Including location, image, voice, video and link
            default:
                if (isset($this->rules[$this->getMsgType()])) {
                    return $this->handle($this->rules[$this->getMsgType()]);
                }
        }

        // Check if enable to transfer to customer service
        if (isset($this->rules['transferCustomer'])) {
            return $this->handle($this->rules['transferCustomer']);
        }

        // Fallback to the default rule
        if (!$this->handled && $this->defaults) {
            return $this->handle($this->defaults);
        }

        return false;
    }
protected function handleMsg ( ) { switch ( $ this -> getMsgType ( ) ) { case 'text' : if ( $ result = $ this -> handleText ( ) ) { return $ result ; } break ; case 'event' : case 'device_event' : $ event = strtolower ( $ this -> getEvent ( ) ) ; switch ( $ event ) { case 'subscribe' : $ result = $ this -> handleEvent ( 'subscribe' ) ; $ scanResult = null ; if ( $ this -> getTicket ( ) ) { $ scanResult = $ this -> handleEvent ( 'scan' ) ; } if ( $ result ) { return $ result ; } if ( $ scanResult ) { return $ scanResult ; } break ; case 'scan' : if ( $ result = $ this -> handleEvent ( 'scan' ) ) { return $ result ; } break ; default : if ( $ result = $ this -> handleEvent ( $ event , $ this -> getEventKey ( ) ) ) { return $ result ; } break ; } break ; // Including location, image, voice, video and link default : if ( isset ( $ this -> rules [ $ this -> getMsgType ( ) ] ) ) { return $ this -> handle ( $ this -> rules [ $ this -> getMsgType ( ) ] ) ; } } // Check if enable to transfer to customer service if ( isset ( $ this -> rules [ 'transferCustomer' ] ) ) { return $ this -> handle ( $ this -> rules [ 'transferCustomer' ] ) ; } // Fallback to the default rule if ( ! $ this -> handled && $ this -> defaults ) { return $ this -> handle ( $ this -> defaults ) ; } return false ; }
Executes the matched rule and returns the rule result

Returns false when the token is invalid or no rules matched

@return string|false
Executes the matched rule and returns the rule result