src/Interval.php
public function compare($x): int
    {
        // if $x is not numeric, short-circuit
        if ( ! is_numeric($x)) {
            throw new InvalidArgumentException(
                __METHOD__ . "() expects parameter one, x, to be a number"
            );    
        }
        
        if (
            $x < $this->lower 
            || ( ! $this->isLowerInclusive && $x == $this->lower)
        ) {
            return -1;
        } elseif (
            $x > $this->upper 
            || ( ! $this->isUpperInclusive && $x == $this->upper)
        ) {
            return 1;
        } else {
            return 0;
        }
    }
public function compare($x): int
    {
        // if $x is not numeric, short-circuit
        if ( ! is_numeric($x)) {
            throw new InvalidArgumentException(
                __METHOD__ . "() expects parameter one, x, to be a number"
            );    
        }
        
        if (
            $x < $this->lower 
            || ( ! $this->isLowerInclusive && $x == $this->lower)
        ) {
            return -1;
        } elseif (
            $x > $this->upper 
            || ( ! $this->isUpperInclusive && $x == $this->upper)
        ) {
            return 1;
        } else {
            return 0;
        }
    }
public function compare ( $ x ) : int { // if $x is not numeric, short-circuit if ( ! is_numeric ( $ x ) ) { throw new InvalidArgumentException ( __METHOD__ . "() expects parameter one, x, to be a number" ) ; } if ( $ x < $ this -> lower || ( ! $ this -> isLowerInclusive && $ x == $ this -> lower ) ) { return - 1 ; } elseif ( $ x > $ this -> upper || ( ! $ this -> isUpperInclusive && $ x == $ this -> upper ) ) { return 1 ; } else { return 0 ; } }
Compare a value to the interval

If $x is below the interval, I'll return -1. If $x is above the interval, I'll
return 1. Otherwise, $x is inside the interval, and I'll return 0.

@param   int|float  $x  the value to compare
@return  int
Compare a value to the interval