original_string: public static function get()
      {
          $cache = Cache::getTransientCache();
          $cacheKey = CacheId::siteAware('MetricsList');
  
          if ($cache->contains($cacheKey)) {
              return $cache->fetch($cacheKey);
          }
  
          $list = new static;
  
          /**
           * Triggered to add new metrics that cannot be picked up automatically by the platform.
           * This is useful if the plugin allows a user to create metrics dynamically. For example
           * CustomDimensions or CustomVariables.
           *
           * **Example**
           *
           *     public function addMetric(&$list)
           *     {
           *         $list->addMetric(new MyCustomMetric());
           *     }
           *
           * @param MetricsList $list An instance of the MetricsList. You can add metrics to the list this way.
           */
          Piwik::postEvent('Metric.addMetrics', array($list));
  
          $dimensions = Dimension::getAllDimensions();
          foreach ($dimensions as $dimension) {
              $factory = new DimensionMetricFactory($dimension);
              $dimension->configureMetrics($list, $factory);
          }
  
          $computedFactory = new ComputedMetricFactory($list);
  
          /**
           * Triggered to add new metrics that cannot be picked up automatically by the platform.
           * This is useful if the plugin allows a user to create metrics dynamically. For example
           * CustomDimensions or CustomVariables.
           *
           * **Example**
           *
           *     public function addMetric(&$list)
           *     {
           *         $list->addMetric(new MyCustomMetric());
           *     }
           *
           * @param MetricsList $list An instance of the MetricsList. You can add metrics to the list this way.
           */
          Piwik::postEvent('Metric.addComputedMetrics', array($list, $computedFactory));
  
          /**
           * Triggered to filter metrics.
           *
           * **Example**
           *
           *     public function removeMetrics(Piwik\Columns\MetricsList $list)
           *     {
           *         $list->remove($category='General_Visits'); // remove all metrics having this category
           *     }
           *
           * @param MetricsList $list An instance of the MetricsList. You can change the list of metrics this way.
           */
          Piwik::postEvent('Metric.filterMetrics', array($list));
  
          $availableMetrics = array();
          foreach ($list->getMetrics() as $metric) {
              $availableMetrics[] = $metric->getName();
          }
  
          foreach ($list->metrics as $index => $metric) {
              if ($metric instanceof ProcessedMetric) {
                  $depMetrics = $metric->getDependentMetrics();
                  if (is_array($depMetrics)) {
                      foreach ($depMetrics as $depMetric) {
                          if (!in_array($depMetric, $availableMetrics, $strict = true)) {
                              unset($list->metrics[$index]); // not resolvable metric
                          }
                      }
                  }
              }
          }
  
          $cache->save($cacheKey, $list);
  
          return $list;
      }
code: public static function get()
      {
          $cache = Cache::getTransientCache();
          $cacheKey = CacheId::siteAware('MetricsList');
  
          if ($cache->contains($cacheKey)) {
              return $cache->fetch($cacheKey);
          }
  
          $list = new static;
  
          /**
           * Triggered to add new metrics that cannot be picked up automatically by the platform.
           * This is useful if the plugin allows a user to create metrics dynamically. For example
           * CustomDimensions or CustomVariables.
           *
           * **Example**
           *
           *     public function addMetric(&$list)
           *     {
           *         $list->addMetric(new MyCustomMetric());
           *     }
           *
           * @param MetricsList $list An instance of the MetricsList. You can add metrics to the list this way.
           */
          Piwik::postEvent('Metric.addMetrics', array($list));
  
          $dimensions = Dimension::getAllDimensions();
          foreach ($dimensions as $dimension) {
              $factory = new DimensionMetricFactory($dimension);
              $dimension->configureMetrics($list, $factory);
          }
  
          $computedFactory = new ComputedMetricFactory($list);
  
          /**
           * Triggered to add new metrics that cannot be picked up automatically by the platform.
           * This is useful if the plugin allows a user to create metrics dynamically. For example
           * CustomDimensions or CustomVariables.
           *
           * **Example**
           *
           *     public function addMetric(&$list)
           *     {
           *         $list->addMetric(new MyCustomMetric());
           *     }
           *
           * @param MetricsList $list An instance of the MetricsList. You can add metrics to the list this way.
           */
          Piwik::postEvent('Metric.addComputedMetrics', array($list, $computedFactory));
  
          /**
           * Triggered to filter metrics.
           *
           * **Example**
           *
           *     public function removeMetrics(Piwik\Columns\MetricsList $list)
           *     {
           *         $list->remove($category='General_Visits'); // remove all metrics having this category
           *     }
           *
           * @param MetricsList $list An instance of the MetricsList. You can change the list of metrics this way.
           */
          Piwik::postEvent('Metric.filterMetrics', array($list));
  
          $availableMetrics = array();
          foreach ($list->getMetrics() as $metric) {
              $availableMetrics[] = $metric->getName();
          }
  
          foreach ($list->metrics as $index => $metric) {
              if ($metric instanceof ProcessedMetric) {
                  $depMetrics = $metric->getDependentMetrics();
                  if (is_array($depMetrics)) {
                      foreach ($depMetrics as $depMetric) {
                          if (!in_array($depMetric, $availableMetrics, $strict = true)) {
                              unset($list->metrics[$index]); // not resolvable metric
                          }
                      }
                  }
              }
          }
  
          $cache->save($cacheKey, $list);
  
          return $list;
      }
code_tokens: public static function get ( ) { $ cache = Cache :: getTransientCache ( ) ; $ cacheKey = CacheId :: siteAware ( 'MetricsList' ) ; if ( $ cache -> contains ( $ cacheKey ) ) { return $ cache -> fetch ( $ cacheKey ) ; } $ list = new static ; /**
           * Triggered to add new metrics that cannot be picked up automatically by the platform.
           * This is useful if the plugin allows a user to create metrics dynamically. For example
           * CustomDimensions or CustomVariables.
           *
           * **Example**
           *
           *     public function addMetric(&$list)
           *     {
           *         $list->addMetric(new MyCustomMetric());
           *     }
           *
           * @param MetricsList $list An instance of the MetricsList. You can add metrics to the list this way.
           */ Piwik :: postEvent ( 'Metric.addMetrics' , array ( $ list ) ) ; $ dimensions = Dimension :: getAllDimensions ( ) ; foreach ( $ dimensions as $ dimension ) { $ factory = new DimensionMetricFactory ( $ dimension ) ; $ dimension -> configureMetrics ( $ list , $ factory ) ; } $ computedFactory = new ComputedMetricFactory ( $ list ) ; /**
           * Triggered to add new metrics that cannot be picked up automatically by the platform.
           * This is useful if the plugin allows a user to create metrics dynamically. For example
           * CustomDimensions or CustomVariables.
           *
           * **Example**
           *
           *     public function addMetric(&$list)
           *     {
           *         $list->addMetric(new MyCustomMetric());
           *     }
           *
           * @param MetricsList $list An instance of the MetricsList. You can add metrics to the list this way.
           */ Piwik :: postEvent ( 'Metric.addComputedMetrics' , array ( $ list , $ computedFactory ) ) ; /**
           * Triggered to filter metrics.
           *
           * **Example**
           *
           *     public function removeMetrics(Piwik\Columns\MetricsList $list)
           *     {
           *         $list->remove($category='General_Visits'); // remove all metrics having this category
           *     }
           *
           * @param MetricsList $list An instance of the MetricsList. You can change the list of metrics this way.
           */ Piwik :: postEvent ( 'Metric.filterMetrics' , array ( $ list ) ) ; $ availableMetrics = array ( ) ; foreach ( $ list -> getMetrics ( ) as $ metric ) { $ availableMetrics [ ] = $ metric -> getName ( ) ; } foreach ( $ list -> metrics as $ index => $ metric ) { if ( $ metric instanceof ProcessedMetric ) { $ depMetrics = $ metric -> getDependentMetrics ( ) ; if ( is_array ( $ depMetrics ) ) { foreach ( $ depMetrics as $ depMetric ) { if ( ! in_array ( $ depMetric , $ availableMetrics , $ strict = true ) ) { unset ( $ list -> metrics [ $ index ] ) ; // not resolvable metric } } } } } $ cache -> save ( $ cacheKey , $ list ) ; return $ list ; }
docstring: Get all metrics defined in the Piwik platform.
  @ignore
  @return static
docstring_tokens: Get all metrics defined in the Piwik platform .