Components/Filter.php
public function getOperatorAndValue($input)
    {
        switch ($this->getType()) {
            case self::TYPE_GREATER:
            case self::TYPE_GREATER_OR_EQUAL:
            case self::TYPE_LESS:
            case self::TYPE_LESS_OR_EQUAL:
            case self::TYPE_NOT_LIKE:
            case self::TYPE_LIKE:
            case self::TYPE_NOT_EQUAL:
            case self::TYPE_EQUAL_STRICT:
            case self::TYPE_LIKE_WORDS_AND:
            case self::TYPE_LIKE_WORDS_OR:
                return array($this->getType(), $input);
            case self::TYPE_AUTO:
            default:
                // handle blank search is different to search 0 value
                if ((string) $input != '') {
                    $simpleOperator = substr($input, 0, 1);
                    $doubleOperator = substr($input, 0, 2);
                    // if start with operators
                    switch ($doubleOperator) {
                        case self::TYPE_GREATER_OR_EQUAL:
                        case self::TYPE_LESS_OR_EQUAL:
                        case self::TYPE_NOT_EQUAL:
                        case self::TYPE_EQUAL_STRICT:
                            return array($doubleOperator, substr($input, 2));
                            break;
                        default:
                            switch ($simpleOperator) {
                                case self::TYPE_GREATER:
                                case self::TYPE_LESS:
                                case self::TYPE_EQUAL:
                                case self::TYPE_NOT_LIKE:
                                    return array($simpleOperator, substr($input, 1));
                                    break;
                                default:
                                    return array(self::TYPE_LIKE, $input);
                                    break;
                            }
                            break;
                    }
                    break;
                }

                    return array(self::TYPE_LIKE, false);
        }
    }
public function getOperatorAndValue($input)
    {
        switch ($this->getType()) {
            case self::TYPE_GREATER:
            case self::TYPE_GREATER_OR_EQUAL:
            case self::TYPE_LESS:
            case self::TYPE_LESS_OR_EQUAL:
            case self::TYPE_NOT_LIKE:
            case self::TYPE_LIKE:
            case self::TYPE_NOT_EQUAL:
            case self::TYPE_EQUAL_STRICT:
            case self::TYPE_LIKE_WORDS_AND:
            case self::TYPE_LIKE_WORDS_OR:
                return array($this->getType(), $input);
            case self::TYPE_AUTO:
            default:
                // handle blank search is different to search 0 value
                if ((string) $input != '') {
                    $simpleOperator = substr($input, 0, 1);
                    $doubleOperator = substr($input, 0, 2);
                    // if start with operators
                    switch ($doubleOperator) {
                        case self::TYPE_GREATER_OR_EQUAL:
                        case self::TYPE_LESS_OR_EQUAL:
                        case self::TYPE_NOT_EQUAL:
                        case self::TYPE_EQUAL_STRICT:
                            return array($doubleOperator, substr($input, 2));
                            break;
                        default:
                            switch ($simpleOperator) {
                                case self::TYPE_GREATER:
                                case self::TYPE_LESS:
                                case self::TYPE_EQUAL:
                                case self::TYPE_NOT_LIKE:
                                    return array($simpleOperator, substr($input, 1));
                                    break;
                                default:
                                    return array(self::TYPE_LIKE, $input);
                                    break;
                            }
                            break;
                    }
                    break;
                }

                    return array(self::TYPE_LIKE, false);
        }
    }
public function getOperatorAndValue ( $ input ) { switch ( $ this -> getType ( ) ) { case self :: TYPE_GREATER : case self :: TYPE_GREATER_OR_EQUAL : case self :: TYPE_LESS : case self :: TYPE_LESS_OR_EQUAL : case self :: TYPE_NOT_LIKE : case self :: TYPE_LIKE : case self :: TYPE_NOT_EQUAL : case self :: TYPE_EQUAL_STRICT : case self :: TYPE_LIKE_WORDS_AND : case self :: TYPE_LIKE_WORDS_OR : return array ( $ this -> getType ( ) , $ input ) ; case self :: TYPE_AUTO : default : // handle blank search is different to search 0 value if ( ( string ) $ input != '' ) { $ simpleOperator = substr ( $ input , 0 , 1 ) ; $ doubleOperator = substr ( $ input , 0 , 2 ) ; // if start with operators switch ( $ doubleOperator ) { case self :: TYPE_GREATER_OR_EQUAL : case self :: TYPE_LESS_OR_EQUAL : case self :: TYPE_NOT_EQUAL : case self :: TYPE_EQUAL_STRICT : return array ( $ doubleOperator , substr ( $ input , 2 ) ) ; break ; default : switch ( $ simpleOperator ) { case self :: TYPE_GREATER : case self :: TYPE_LESS : case self :: TYPE_EQUAL : case self :: TYPE_NOT_LIKE : return array ( $ simpleOperator , substr ( $ input , 1 ) ) ; break ; default : return array ( self :: TYPE_LIKE , $ input ) ; break ; } break ; } break ; } return array ( self :: TYPE_LIKE , false ) ; } }
Get the operator and the value of an input string.

@param string $input

@return array [string operator,string value]
Get the operator and the value of an input string .