src/Model/Version.php
public function is()
    {
        $valid = false;

        $arguments = func_get_args();
        if (count($arguments)) {
            $operator = '=';
            $compare = null;

            if (count($arguments) == 1) {
                $compare = $arguments[0];
            }

            if (count($arguments) >= 2) {
                $operator = $arguments[0];
                $compare = $arguments[1];
            }

            if (!is_null($compare)) {
                $min = min(substr_count($this->value, '.'), substr_count($compare, '.')) + 1;

                $v1 = $this->toValue($this->value, $min);
                $v2 = $this->toValue($compare, $min);

                switch ($operator) {
                    case '<':
                        $valid = $v1 < $v2;
                        break;
                    case '<=':
                        $valid = $v1 <= $v2;
                        break;
                    case '=':
                        $valid = $v1 == $v2;
                        break;
                    case '>':
                        $valid = $v1 > $v2;
                        break;
                    case '>=':
                        $valid = $v1 >= $v2;
                        break;
                }
            }
        }

        return $valid;
    }
public function is()
    {
        $valid = false;

        $arguments = func_get_args();
        if (count($arguments)) {
            $operator = '=';
            $compare = null;

            if (count($arguments) == 1) {
                $compare = $arguments[0];
            }

            if (count($arguments) >= 2) {
                $operator = $arguments[0];
                $compare = $arguments[1];
            }

            if (!is_null($compare)) {
                $min = min(substr_count($this->value, '.'), substr_count($compare, '.')) + 1;

                $v1 = $this->toValue($this->value, $min);
                $v2 = $this->toValue($compare, $min);

                switch ($operator) {
                    case '<':
                        $valid = $v1 < $v2;
                        break;
                    case '<=':
                        $valid = $v1 <= $v2;
                        break;
                    case '=':
                        $valid = $v1 == $v2;
                        break;
                    case '>':
                        $valid = $v1 > $v2;
                        break;
                    case '>=':
                        $valid = $v1 >= $v2;
                        break;
                }
            }
        }

        return $valid;
    }
public function is ( ) { $ valid = false ; $ arguments = func_get_args ( ) ; if ( count ( $ arguments ) ) { $ operator = '=' ; $ compare = null ; if ( count ( $ arguments ) == 1 ) { $ compare = $ arguments [ 0 ] ; } if ( count ( $ arguments ) >= 2 ) { $ operator = $ arguments [ 0 ] ; $ compare = $ arguments [ 1 ] ; } if ( ! is_null ( $ compare ) ) { $ min = min ( substr_count ( $ this -> value , '.' ) , substr_count ( $ compare , '.' ) ) + 1 ; $ v1 = $ this -> toValue ( $ this -> value , $ min ) ; $ v2 = $ this -> toValue ( $ compare , $ min ) ; switch ( $ operator ) { case '<' : $ valid = $ v1 < $ v2 ; break ; case '<=' : $ valid = $ v1 <= $ v2 ; break ; case '=' : $ valid = $ v1 == $ v2 ; break ; case '>' : $ valid = $ v1 > $ v2 ; break ; case '>=' : $ valid = $ v1 >= $ v2 ; break ; } } } return $ valid ; }
Determine if the version is lower, equal or higher than the specified value

@param  string   The operator, must be <, <=, =, >= or >
@param  mixed    The value, can be an integer, float or string with a version number

@return boolean
Determine if the version is lower equal or higher than the specified value