original_string: 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;
          });
      }
code: 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;
          });
      }
code_tokens: 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 ; } ) ; }
docstring: Returns all points as an array, by x hours.
  
  @param \CachetHQ\Cachet\Models\Metric $metric
  @param int                            $hours
  
  @return array
docstring_tokens: Returns all points as an array by x hours .