/**
  * @dataProvider getScopesSupportExtractions
  */
 public function test_doesScopeSupportExtractions($expectedSupportsExtractions, $scope)
 {
     $this->assertSame($expectedSupportsExtractions, CustomDimensions::doesScopeSupportExtractions($scope));
 }
예제 #2
0
 /**
  * Get a list of all supported scopes that can be used in the API method
  * `CustomDimensions.configureNewCustomDimension`. The response also contains information whether more Custom
  * Dimensions can be created or not. Requires at least Admin access for the specified website.
  *
  * @param int $idSite
  * @return array
  */
 public function getAvailableScopes($idSite)
 {
     Piwik::checkUserHasAdminAccess($idSite);
     $scopes = array();
     foreach (CustomDimensions::getPublicScopes() as $scope) {
         $configs = $this->getConfiguration()->getCustomDimensionsHavingScope($idSite, $scope);
         $indexes = $this->getTracking($scope)->getInstalledIndexes();
         $scopes[] = array('value' => $scope, 'name' => Piwik::translate('General_TrackingScope' . ucfirst($scope)), 'numSlotsAvailable' => count($indexes), 'numSlotsUsed' => count($configs), 'numSlotsLeft' => count($indexes) - count($configs), 'supportsExtractions' => CustomDimensions::doesScopeSupportExtractions($scope));
     }
     return $scopes;
 }