public function diffFiltered(ChronosInterval $ci, callable $callback, ChronosInterface $dt = null, $abs = true)
    {
        $start = $this;
        $end = $dt === null ? static::now($this->tz) : $dt;
        $inverse = false;

        if (defined('HHVM_VERSION')) {
            $start = new DateTimeImmutable($this->toIso8601String());
            $end = new DateTimeImmutable($end->toIso8601String());
        }

        if ($end < $start) {
            $start = $end;
            $end = $this;
            $inverse = true;
        }

        $period = new DatePeriod($start, $ci, $end);
        $vals = array_filter(iterator_to_array($period), function (DateTimeInterface $date) use ($callback) {
            return $callback(static::instance($date));
        });

        $diff = count($vals);

        return $inverse && !$abs ? -$diff : $diff;
    }
public function diffFiltered(ChronosInterval $ci, callable $callback, ChronosInterface $dt = null, $abs = true)
    {
        $start = $this;
        $end = $dt === null ? static::now($this->tz) : $dt;
        $inverse = false;

        if (defined('HHVM_VERSION')) {
            $start = new DateTimeImmutable($this->toIso8601String());
            $end = new DateTimeImmutable($end->toIso8601String());
        }

        if ($end < $start) {
            $start = $end;
            $end = $this;
            $inverse = true;
        }

        $period = new DatePeriod($start, $ci, $end);
        $vals = array_filter(iterator_to_array($period), function (DateTimeInterface $date) use ($callback) {
            return $callback(static::instance($date));
        });

        $diff = count($vals);

        return $inverse && !$abs ? -$diff : $diff;
    }
public function diffFiltered ( ChronosInterval $ ci , callable $ callback , ChronosInterface $ dt = null , $ abs = true ) { $ start = $ this ; $ end = $ dt === null ? static :: now ( $ this -> tz ) : $ dt ; $ inverse = false ; if ( defined ( 'HHVM_VERSION' ) ) { $ start = new DateTimeImmutable ( $ this -> toIso8601String ( ) ) ; $ end = new DateTimeImmutable ( $ end -> toIso8601String ( ) ) ; } if ( $ end < $ start ) { $ start = $ end ; $ end = $ this ; $ inverse = true ; } $ period = new DatePeriod ( $ start , $ ci , $ end ) ; $ vals = array_filter ( iterator_to_array ( $ period ) , function ( DateTimeInterface $ date ) use ( $ callback ) { return $ callback ( static :: instance ( $ date ) ) ; } ) ; $ diff = count ( $ vals ) ; return $ inverse && ! $ abs ? - $ diff : $ diff ; }
Get the difference by the given interval using a filter callable

@param \Cake\Chronos\ChronosInterval $ci An interval to traverse by
@param callable $callback The callback to use for filtering.
@param \Cake\Chronos\ChronosInterface|null $dt The instance to difference from.
@param bool $abs Get the absolute of the difference
@return int
Get the difference by the given interval using a filter callable