src/Parser/IntervalParser.php
private function parseValue($value, bool $isLeft, bool $isOpen)
    {
        if ($this->isInt($value)) {
            return new Integer((int)$value, $isLeft, $isOpen);
        }

        if ($this->isInfinity($value)) {
            $value = '-INF' === $value ? -\INF : \INF;
            return new Infinity($value, $isLeft, $isOpen);
        }

        if ($this->isFloat($value)) {
            return new Real((float)$value, $isLeft, $isOpen);
        }

        if ($this->isDate($value)) {
            $value = \DateTimeImmutable::createFromFormat('U', (string)\strtotime($value));
            $value = $value->setTimezone(new \DateTimeZone(\date_default_timezone_get()));
            return new DateTime($value, $isLeft, $isOpen);
        }

        throw new \InvalidArgumentException('Unexpected $value type');
    }
private function parseValue($value, bool $isLeft, bool $isOpen)
    {
        if ($this->isInt($value)) {
            return new Integer((int)$value, $isLeft, $isOpen);
        }

        if ($this->isInfinity($value)) {
            $value = '-INF' === $value ? -\INF : \INF;
            return new Infinity($value, $isLeft, $isOpen);
        }

        if ($this->isFloat($value)) {
            return new Real((float)$value, $isLeft, $isOpen);
        }

        if ($this->isDate($value)) {
            $value = \DateTimeImmutable::createFromFormat('U', (string)\strtotime($value));
            $value = $value->setTimezone(new \DateTimeZone(\date_default_timezone_get()));
            return new DateTime($value, $isLeft, $isOpen);
        }

        throw new \InvalidArgumentException('Unexpected $value type');
    }
private function parseValue ( $ value , bool $ isLeft , bool $ isOpen ) { if ( $ this -> isInt ( $ value ) ) { return new Integer ( ( int ) $ value , $ isLeft , $ isOpen ) ; } if ( $ this -> isInfinity ( $ value ) ) { $ value = '-INF' === $ value ? - \ INF : \ INF ; return new Infinity ( $ value , $ isLeft , $ isOpen ) ; } if ( $ this -> isFloat ( $ value ) ) { return new Real ( ( float ) $ value , $ isLeft , $ isOpen ) ; } if ( $ this -> isDate ( $ value ) ) { $ value = \ DateTimeImmutable :: createFromFormat ( 'U' , ( string ) \ strtotime ( $ value ) ) ; $ value = $ value -> setTimezone ( new \ DateTimeZone ( \ date_default_timezone_get ( ) ) ) ; return new DateTime ( $ value , $ isLeft , $ isOpen ) ; } throw new \ InvalidArgumentException ( 'Unexpected $value type' ) ; }
Cast a value to its expected type
@param mixed $value
@param bool $isLeft
@param bool $isOpen
@return float|int|string
@throws \InvalidArgumentException
Cast a value to its expected type