public function listPointsToday(Metric $metric, $hours = 12)
    {
        $dateTime = $this->dates->make();
        $pointKey = $dateTime->format('Y-m-d H:00');
        $points = $this->repository->getPointsSinceHour($metric, $hours)->pluck('value', 'key');

        for ($i = 0; $i < $hours; $i++) {
            if (!$points->has($pointKey)) {
                $points->put($pointKey, $metric->default_value);
            }

            $pointKey = $dateTime->sub(new DateInterval('PT1H'))->format('Y-m-d H:00');
        }

        return $points->sortBy(function ($point, $key) {
            return $key;
        });
    }
public function listPointsToday(Metric $metric, $hours = 12)
    {
        $dateTime = $this->dates->make();
        $pointKey = $dateTime->format('Y-m-d H:00');
        $points = $this->repository->getPointsSinceHour($metric, $hours)->pluck('value', 'key');

        for ($i = 0; $i < $hours; $i++) {
            if (!$points->has($pointKey)) {
                $points->put($pointKey, $metric->default_value);
            }

            $pointKey = $dateTime->sub(new DateInterval('PT1H'))->format('Y-m-d H:00');
        }

        return $points->sortBy(function ($point, $key) {
            return $key;
        });
    }
public function listPointsToday ( Metric $ metric , $ hours = 12 ) { $ dateTime = $ this -> dates -> make ( ) ; $ pointKey = $ dateTime -> format ( 'Y-m-d H:00' ) ; $ points = $ this -> repository -> getPointsSinceHour ( $ metric , $ hours ) -> pluck ( 'value' , 'key' ) ; for ( $ i = 0 ; $ i < $ hours ; $ i ++ ) { if ( ! $ points -> has ( $ pointKey ) ) { $ points -> put ( $ pointKey , $ metric -> default_value ) ; } $ pointKey = $ dateTime -> sub ( new DateInterval ( 'PT1H' ) ) -> format ( 'Y-m-d H:00' ) ; } return $ points -> sortBy ( function ( $ point , $ key ) { return $ key ; } ) ; }
Returns all points as an array, by x hours.

@param \CachetHQ\Cachet\Models\Metric $metric
@param int                            $hours

@return array
Returns all points as an array by x hours .