original_string: public function getMetrics(Metric $metric)
      {
          $type = Binput::get('filter', AutoPresenter::decorate($metric)->view_name);
          $metrics = app(MetricRepository::class);
  
          switch ($type) {
              case 'last_hour': $metricData = $metrics->listPointsLastHour($metric); break;
              case 'today': $metricData = $metrics->listPointsToday($metric); break;
              case 'week': $metricData = $metrics->listPointsForWeek($metric); break;
              case 'month': $metricData = $metrics->listPointsForMonth($metric); break;
              default: $metricData = [];
          }
  
          return $this->item([
              'metric' => $metric->toArray(),
              'items'  => $metricData,
          ]);
      }
code: public function getMetrics(Metric $metric)
      {
          $type = Binput::get('filter', AutoPresenter::decorate($metric)->view_name);
          $metrics = app(MetricRepository::class);
  
          switch ($type) {
              case 'last_hour': $metricData = $metrics->listPointsLastHour($metric); break;
              case 'today': $metricData = $metrics->listPointsToday($metric); break;
              case 'week': $metricData = $metrics->listPointsForWeek($metric); break;
              case 'month': $metricData = $metrics->listPointsForMonth($metric); break;
              default: $metricData = [];
          }
  
          return $this->item([
              'metric' => $metric->toArray(),
              'items'  => $metricData,
          ]);
      }
code_tokens: public function getMetrics ( Metric $ metric ) { $ type = Binput :: get ( 'filter' , AutoPresenter :: decorate ( $ metric ) -> view_name ) ; $ metrics = app ( MetricRepository :: class ) ; switch ( $ type ) { case 'last_hour' : $ metricData = $ metrics -> listPointsLastHour ( $ metric ) ; break ; case 'today' : $ metricData = $ metrics -> listPointsToday ( $ metric ) ; break ; case 'week' : $ metricData = $ metrics -> listPointsForWeek ( $ metric ) ; break ; case 'month' : $ metricData = $ metrics -> listPointsForMonth ( $ metric ) ; break ; default : $ metricData = [ ] ; } return $ this -> item ( [ 'metric' => $ metric -> toArray ( ) , 'items' => $ metricData , ] ) ; }
docstring: Returns metrics in a readily formatted way.
  
  @param \CachetHQ\Cachet\Models\Metric $metric
  
  @return \Illuminate\Http\JsonResponse
docstring_tokens: Returns metrics in a readily formatted way .