src/Duration.php
public function compareTo(Duration $that) : int
    {
        $seconds = $this->seconds - $that->seconds;

        if ($seconds !== 0) {
            return $seconds > 0 ? 1 : -1;
        }

        $nanos = $this->nanos - $that->nanos;

        if ($nanos !== 0) {
            return $nanos > 0 ? 1 : -1;
        }

        return 0;
    }
public function compareTo(Duration $that) : int
    {
        $seconds = $this->seconds - $that->seconds;

        if ($seconds !== 0) {
            return $seconds > 0 ? 1 : -1;
        }

        $nanos = $this->nanos - $that->nanos;

        if ($nanos !== 0) {
            return $nanos > 0 ? 1 : -1;
        }

        return 0;
    }
public function compareTo ( Duration $ that ) : int { $ seconds = $ this -> seconds - $ that -> seconds ; if ( $ seconds !== 0 ) { return $ seconds > 0 ? 1 : - 1 ; } $ nanos = $ this -> nanos - $ that -> nanos ; if ( $ nanos !== 0 ) { return $ nanos > 0 ? 1 : - 1 ; } return 0 ; }
Compares this Duration to the specified duration.

@param \Brick\DateTime\Duration $that The other duration to compare to.

@return int [-1,0,1] If this duration is less than, equal to, or greater than the given duration.
Compares this Duration to the specified duration .