original_string: public function listPointsLastHour(Metric $metric)
      {
          $dateTime = $this->dates->make();
          $pointKey = $dateTime->format('Y-m-d H:i');
          $nrOfMinutes = 61;
          $points = $this->repository->getPointsSinceMinutes($metric, $nrOfMinutes + $metric->threshold)->pluck('value', 'key')->take(-$nrOfMinutes);
  
          $timeframe = $nrOfMinutes;
          for ($i = 0; $i < $timeframe; $i++) {
              if (!$points->has($pointKey)) {
                  if ($i >= $metric->threshold) {
                      $points->put($pointKey, $metric->default_value);
                  } else {
                      // The point not found is still within the threshold, so it is ignored and
                      // the timeframe is shifted by one minute
                      $timeframe++;
                  }
              }
  
              $pointKey = $dateTime->sub(new DateInterval('PT1M'))->format('Y-m-d H:i');
          }
  
          return $points->sortBy(function ($point, $key) {
              return $key;
          });
      }
code: public function listPointsLastHour(Metric $metric)
      {
          $dateTime = $this->dates->make();
          $pointKey = $dateTime->format('Y-m-d H:i');
          $nrOfMinutes = 61;
          $points = $this->repository->getPointsSinceMinutes($metric, $nrOfMinutes + $metric->threshold)->pluck('value', 'key')->take(-$nrOfMinutes);
  
          $timeframe = $nrOfMinutes;
          for ($i = 0; $i < $timeframe; $i++) {
              if (!$points->has($pointKey)) {
                  if ($i >= $metric->threshold) {
                      $points->put($pointKey, $metric->default_value);
                  } else {
                      // The point not found is still within the threshold, so it is ignored and
                      // the timeframe is shifted by one minute
                      $timeframe++;
                  }
              }
  
              $pointKey = $dateTime->sub(new DateInterval('PT1M'))->format('Y-m-d H:i');
          }
  
          return $points->sortBy(function ($point, $key) {
              return $key;
          });
      }
code_tokens: public function listPointsLastHour ( Metric $ metric ) { $ dateTime = $ this -> dates -> make ( ) ; $ pointKey = $ dateTime -> format ( 'Y-m-d H:i' ) ; $ nrOfMinutes = 61 ; $ points = $ this -> repository -> getPointsSinceMinutes ( $ metric , $ nrOfMinutes + $ metric -> threshold ) -> pluck ( 'value' , 'key' ) -> take ( - $ nrOfMinutes ) ; $ timeframe = $ nrOfMinutes ; for ( $ i = 0 ; $ i < $ timeframe ; $ i ++ ) { if ( ! $ points -> has ( $ pointKey ) ) { if ( $ i >= $ metric -> threshold ) { $ points -> put ( $ pointKey , $ metric -> default_value ) ; } else { // The point not found is still within the threshold, so it is ignored and // the timeframe is shifted by one minute $ timeframe ++ ; } } $ pointKey = $ dateTime -> sub ( new DateInterval ( 'PT1M' ) ) -> format ( 'Y-m-d H:i' ) ; } return $ points -> sortBy ( function ( $ point , $ key ) { return $ key ; } ) ; }
docstring: Returns all points as an array, for the last hour.
  
  @param \CachetHQ\Cachet\Models\Metric $metric
  
  @return \Illuminate\Support\Collection
docstring_tokens: Returns all points as an array for the last hour .