public function extendVisitorDetails(&$visitor, $details)
 {
     if (empty($visitor['idSite'])) {
         return;
     }
     $idSite = $visitor['idSite'];
     $dimensions = $this->configuration->getCustomDimensionsHavingScope($idSite, self::SCOPE_VISIT);
     $visit = new Visitor($details);
     $values = $visit->getCustomDimensionValues($dimensions);
     foreach ($values as $field => $value) {
         $visitor[$field] = $value;
     }
 }
 public function test_getCustomDimensionsHavingScope_shouldFindEntriesHavingScopeAndSite()
 {
     $this->createManyCustomDimensionCases();
     $dimensions = $this->config->getCustomDimensionsHavingScope($idSite = 1, $scope = 'action');
     $this->assertCount(2, $dimensions);
     foreach ($dimensions as $dimension) {
         $this->assertSame('1', $dimension['idsite']);
         $this->assertSame('action', $dimension['scope']);
         $this->assertTrue(is_bool($dimension['active']));
     }
     $dimensions = $this->config->getCustomDimensionsHavingScope($idSite = 1, $scope = 'visit');
     $this->assertCount(3, $dimensions);
     foreach ($dimensions as $dimension) {
         $this->assertSame('1', $dimension['idsite']);
         $this->assertSame('visit', $dimension['scope']);
         $this->assertTrue(is_bool($dimension['active']));
     }
     // nothing matches
     $dimensions = $this->config->getCustomDimensionsHavingScope($idSite = 1, $scope = 'nothing');
     $this->assertSame(array(), $dimensions);
 }