original_string: public function getMetricsRequiredForReport($allMetrics = null, $restrictToColumns = null)
      {
          if (empty($allMetrics)) {
              $allMetrics = $this->metrics;
          }
  
          if (empty($restrictToColumns)) {
              $restrictToColumns = array_merge($allMetrics, array_keys($this->getProcessedMetrics()));
          }
          $restrictToColumns = array_unique($restrictToColumns);
  
          $processedMetricsById = $this->getProcessedMetricsById();
          $metricsSet = array_flip($allMetrics);
  
          $metrics = array();
          foreach ($restrictToColumns as $column) {
              if (isset($processedMetricsById[$column])) {
                  $metrics = array_merge($metrics, $processedMetricsById[$column]->getDependentMetrics());
              } elseif (isset($metricsSet[$column])) {
                  $metrics[] = $column;
              }
          }
          return array_unique($metrics);
      }
code: public function getMetricsRequiredForReport($allMetrics = null, $restrictToColumns = null)
      {
          if (empty($allMetrics)) {
              $allMetrics = $this->metrics;
          }
  
          if (empty($restrictToColumns)) {
              $restrictToColumns = array_merge($allMetrics, array_keys($this->getProcessedMetrics()));
          }
          $restrictToColumns = array_unique($restrictToColumns);
  
          $processedMetricsById = $this->getProcessedMetricsById();
          $metricsSet = array_flip($allMetrics);
  
          $metrics = array();
          foreach ($restrictToColumns as $column) {
              if (isset($processedMetricsById[$column])) {
                  $metrics = array_merge($metrics, $processedMetricsById[$column]->getDependentMetrics());
              } elseif (isset($metricsSet[$column])) {
                  $metrics[] = $column;
              }
          }
          return array_unique($metrics);
      }
code_tokens: public function getMetricsRequiredForReport ( $ allMetrics = null , $ restrictToColumns = null ) { if ( empty ( $ allMetrics ) ) { $ allMetrics = $ this -> metrics ; } if ( empty ( $ restrictToColumns ) ) { $ restrictToColumns = array_merge ( $ allMetrics , array_keys ( $ this -> getProcessedMetrics ( ) ) ) ; } $ restrictToColumns = array_unique ( $ restrictToColumns ) ; $ processedMetricsById = $ this -> getProcessedMetricsById ( ) ; $ metricsSet = array_flip ( $ allMetrics ) ; $ metrics = array ( ) ; foreach ( $ restrictToColumns as $ column ) { if ( isset ( $ processedMetricsById [ $ column ] ) ) { $ metrics = array_merge ( $ metrics , $ processedMetricsById [ $ column ] -> getDependentMetrics ( ) ) ; } elseif ( isset ( $ metricsSet [ $ column ] ) ) { $ metrics [ ] = $ column ; } } return array_unique ( $ metrics ) ; }
docstring: Returns the list of metrics required at minimum for a report factoring in the columns requested by
  the report requester.
  
  This will return all the metrics requested (or all the metrics in the report if nothing is requested)
  **plus** the metrics required to calculate the requested processed metrics.
  
  This method should be used in **Plugin.get** API methods.
  
  @param string[]|null $allMetrics The list of all available unprocessed metrics. Defaults to this report's
  metrics.
  @param string[]|null $restrictToColumns The requested columns.
  @return string[]
docstring_tokens: Returns the list of metrics required at minimum for a report factoring in the columns requested by the report requester .