Return an array of all typed dimensions used by the contexts
@return array of strings
487382
public function AllTypedDimensions()
	{
		// In PHP 7.0 $this is passed to closure functions automatically but not in earlier versions
		$contexts = &$this->contexts;
		$namespaces = $this->instance->getInstanceNamespaces();

		$result = array_reduce( array_keys( $this->contexts ), function( $carry, $context ) use( &$contexts, &$namespaces )
		{
			$ctx = $contexts[ $context ];
			$typedMembers = isset( $ctx['entity']['segment']['typedMember'] )
				? $ctx['entity']['segment']['typedMember']
				: ( isset( $ctx['segment']['typedMember'] )
					  ? $ctx['segment']['typedMember']
					  : ( isset( $ctx['entity']['scenario']['typedMember'] )
							? $ctx['entity']['scenario']['typedMember']
							: ( isset( $ctx['scenario']['typedMember'] )
					  			? $ctx['scenario']['typedMember']
								: null
							  )
					  	)
				  );

			if ( ! $typedMembers ) return $carry;

			foreach ( $typedMembers as $typedMember )
			{
				$qname = qname( $typedMember['dimension'], $namespaces );
				$carry[ $qname->clarkNotation() ][] = $context;
			}

			return $carry;

		}, array() );

		return $result;
	}
334182
private static function fetchDimensions()
    {
        if (DIRECTORY_SEPARATOR === '\\') {
            $dimensions = static::getAnsiCon();
            if (!$dimensions) {
                $dimensions = static::getConsoleMode();
            }
        } else {
            $dimensions = static::getSttyColumns();
        }

        // Default, if above methods fail.
        $dimensions += [80, 50];

        static::$width = $dimensions[0];
        static::$height = $dimensions[1];

        // Reset signal handler flag.
        static::$pcntlNeedsUpdate = false;
    }
680027
protected function getDimensionsForUnixLike(): ?array
	{
		// Attempt to get dimensions from environment

		if(($width = getenv('COLUMNS')) !== false && ($height = getenv('LINES')) !== false)
		{
			return ['width' => (int) $width, 'height' => (int) $height];
		}

		// Attempt to get dimensions from stty

		exec('stty size', $output, $status);

		if($status === 0 && preg_match('/^([0-9]+) ([0-9]+)$/', current($output), $matches))
		{
			return ['width' => (int) $matches[2], 'height' => (int) $matches[1]];
		}

		// All attempts failed so we'll just return null

		return null;
	}
160709
public function getDimension() {
        $w = 0;
        $h = 0;

        $dimension = $this->font->getDimension();
        $w = $dimension[0];
        $h = $dimension[1];

        if ($this->position === self::POSITION_TOP || $this->position === self::POSITION_BOTTOM) {
            $h += $this->spacing;
            $w += max(0, $this->offset);
        } else {
            $w += $this->spacing;
            $h += max(0, $this->offset);
        }

        return array($w, $h);
    }
665764
public function getDefinitionDimensions()
	{
		if ( $this->dimensionsCache !== null ) return $this->dimensionsCache;

		$dimensions = array();
		$taxonomy_base_name = $this->getTaxonomyXSD();

		foreach ( $this->getDefinitionRoleRefs() as $roleRefsKey => $role )
		{
			$dimensions += $this->getDefinitionRoleDimensions( $roleRefsKey );
		}

		$this->dimensionsCache = $dimensions;
		return $dimensions;
	}
931659
public function getContext()
    {
        return [
            'username' => $this->username,
            'requestPath' => $this->requestPath,
            'errors' => $this->errors,
            'groups' => $this->groups,
            'successful' => !$this->errors
        ];
    }
1024708
public function getDimensions(): array
	{
		$dimensions = PHP_OS_FAMILY === 'Windows' ? $this->getDimensionsForWindows() : $this->getDimensionsForUnixLike();

		return $dimensions ?? ['width' => static::DEFAULT_WIDTH, 'height' => static::DEFAULT_HEIGHT];
	}
434836
public function getNamespaces()
    {
        $result = [];
        foreach ($this->registry[NamespaceExtension::class] as $extension) {
            foreach ($extension->getNamespaces() as $prefix => $namespace) {
                $result[$prefix] = $namespace;
            }
        }

        return $result;
    }
11591
public function getContextualSubstitutes()
    {
        $substitutesWidgetMaps = [];
        $viewWidgetMaps = $this->getContextualView()->getWidgetMapsForViewAndTemplates();

        foreach ($viewWidgetMaps as $viewWidgetMap) {
            if ($viewWidgetMap->getReplaced() == $this) {
                $substitutesWidgetMaps[] = $viewWidgetMap;
            }
        }

        return $substitutesWidgetMaps;
    }
284936
public function getContext()
    {
        $context = [];
        foreach ($this->contextProviders as $contextProvider) {
            $context[] = $contextProvider->getContext();
        }

        return empty($context) ? $context : call_user_func_array('array_merge', $context);
    }
49007
protected function getInsertDimensions()
    {
        $width = $this->owner->getWidth();
        $height = $this->owner->getHeight();
        if (!$height || !$width) {
            return null;
        }

        $maxWidth = $this->owner->config()->get('insert_width');
        $maxHeight = $this->owner->config()->get('insert_height');

        // Within bounds
        if ($width < $maxWidth && $height < $maxHeight) {
            return [
                'width' => $width,
                'height' => $height,
            ];
        }

        // Check if sizing by height or width
        if (($width * $maxHeight) < ($height * $maxWidth)) {
            // Size by height
            return [
                'width' => intval(($width * $maxHeight) / $height + 0.5),
                'height' => $maxHeight,
            ];
        } else {
            // Size by width
            return [
                'width' => $maxWidth,
                'height' => intval(($height * $maxWidth) / $width + 0.5),
            ];
        }
    }
287196
public static function getAllDimensions()
    {
        $cacheId = CacheId::siteAware(CacheId::pluginAware('AllDimensions'));
        $cache   = PiwikCache::getTransientCache();

        if (!$cache->contains($cacheId)) {
            $plugins   = PluginManager::getInstance()->getPluginsLoadedAndActivated();
            $instances = array();

            /**
             * Triggered to add new dimensions that cannot be picked up automatically by the platform.
             * This is useful if the plugin allows a user to create reports / dimensions dynamically. For example
             * CustomDimensions or CustomVariables. There are a variable number of dimensions in this case and it
             * wouldn't be really possible to create a report file for one of these dimensions as it is not known
             * how many Custom Dimensions will exist.
             *
             * **Example**
             *
             *     public function addDimension(&$dimensions)
             *     {
             *         $dimensions[] = new MyCustomDimension();
             *     }
             *
             * @param Dimension[] $reports An array of dimensions
             */
            Piwik::postEvent('Dimension.addDimensions', array(&$instances));

            foreach ($plugins as $plugin) {
                foreach (self::getDimensions($plugin) as $instance) {
                    $instances[] = $instance;
                }
            }

            /**
             * Triggered to filter / restrict dimensions.
             *
             * **Example**
             *
             *     public function filterDimensions(&$dimensions)
             *     {
             *         foreach ($dimensions as $index => $dimension) {
             *              if ($dimension->getName() === 'Page URL') {}
             *                  unset($dimensions[$index]); // remove this dimension
             *              }
             *         }
             *     }
             *
             * @param Dimension[] $dimensions An array of dimensions
             */
            Piwik::postEvent('Dimension.filterDimensions', array(&$instances));

            $cache->save($cacheId, $instances);
        }

        return $cache->fetch($cacheId);
    }
1351792
public java.util.List<Dimension> getDimensions() {
        if (dimensions == null) {
            dimensions = new com.amazonaws.internal.SdkInternalList<Dimension>();
        }
        return dimensions;
    }
579793
protected function getDimensions()
    {
        $output = $this->exec('mode CON', true);

        if (!is_array($output)) {
            return [];
        }

        $output = implode("\n", $output);

        preg_match_all('/.*:\s*(\d+)/', $output, $matches);

        return (!empty($matches[1])) ? $matches[1] : [];
    }
810439
protected function getDimensions()
    {
        // Default result
        $result = [0, 0];

        // If we have a resource already loaded, this means we have modified the resource since the
        // original image was loaded. This means the "Variant" tuple key is out of date, and we don't
        // have a reliable cache key to load from, or save to. If we use the original tuple as a key,
        // we would run the risk of overwriting the original dimensions in the cache, with the values
        // of the resized instead.
        // Instead, we use the immediately available dimensions attached to this resource, and we will
        // rely on cache warming in writeToStore to save these values, where the "Variant" becomes available,
        // before the next time this variant is loaded into memory.
        $resource = $this->image;
        if ($resource) {
            return $this->getResourceDimensions($resource);
        }

        // Check if we have a container
        $container = $this->getAssetContainer();
        if (!$container) {
            return $result;
        }

        // Check cache for unloaded image
        $cache = $this->getCache();
        $key = $this->getDimensionCacheKey($container->getHash(), $container->getVariant());
        if ($cache->has($key)) {
            return $cache->get($key);
        }

        // Cache-miss
        $resource = $this->getImageResource();
        if ($resource) {
            $result = $this->getResourceDimensions($resource);
            $cache->set($key, $result);
        }
        return $result;
    }
295579
public function getClasses()
    {
        $classes = [];
        $sizes = $this->sizes;
        if (isset($sizes['phone'])) {
            $classes[] = 'col-xs-' . $sizes['phone'];
        }
        if (isset($sizes['tablet'])) {
            $classes[] = 'col-sm-' . $sizes['tablet'];
        }
        if (isset($sizes['mediumDesktop'])) {
            $classes[] = 'col-md-' . $sizes['mediumDesktop'];
        }
        if (isset($sizes['largeDesktop'])) {
            $classes[] = 'col-lg-' . $sizes['largeDesktop'];
        }

        return implode(' ', $classes);
    }
171951
public function getDimensions()
    {
        $dimensions = [];

        if (!empty($this->getDimension())) {
            $dimensionId = str_replace('.', '_', $this->getDimension()->getId());
            $dimensions[$dimensionId] = $this->getDimension()->getName();
        }

        if (!empty($this->getSubtableDimension())) {
            $subDimensionId = str_replace('.', '_', $this->getSubtableDimension()->getId());
            $dimensions[$subDimensionId] = $this->getSubtableDimension()->getName();
        }

        if (!empty($this->getThirdLeveltableDimension())) {
            $subDimensionId = str_replace('.', '_', $this->getThirdLeveltableDimension()->getId());
            $dimensions[$subDimensionId] = $this->getThirdLeveltableDimension()->getName();
        }

        return $dimensions;
    }