Returns a {@see Cache} object for a sub-namespace.

@param string $namespace
@param int $defaultTTL
@return Cache
9625
public function ns($namespace, $defaultTTL = null)
    {
        $namespace = $this->id($namespace);
        $defaultTTL = $defaultTTL ?: $this->defaultTTL;
        return new Cache($this->backend, $namespace, $defaultTTL, $this->ttlVariation);
    }
423172
public function evaluateEntityNamespace(string $namespace)
    {
        /**
         * Trying to generate new entity given that the class is the entity
         * namespace.
         */
        if (class_exists($namespace)) {
            return $namespace;
        }

        /**
         * Trying to generate new entity given that the namespace is defined in
         * as a Container parameter.
         */
        $container = $this->container;
        if (
            $container->hasParameter($namespace) &&
            class_exists($container->getParameter($namespace))
        ) {
            $namespaceParameter = $container->getParameter($namespace);

            return $namespaceParameter;
        }

        $resolvedNamespace = explode(':', $namespace, 2);
        $bundles = $this->kernel->getBundles();

        /**
         * Trying to get entity using Doctrine short format.
         *
         * MyBundle:MyEntity
         *
         * To accept this format, entities must be at Entity/ folder in the
         * bundle root dir
         *
         * /MyBundle/Entity/MyEntity
         *
         * If entity definition is wrong, throw exception
         * If bundle not exists or is not actived, throw Exception
         */
        if (
        !(
            isset($resolvedNamespace[0]) &&
            isset($bundles[$resolvedNamespace[0]]) &&
            $bundles[$resolvedNamespace[0]] instanceof Bundle &&
            isset($resolvedNamespace[1])
        )
        ) {
            throw new ClassNotFoundException(
                $namespace,
                new ErrorException()
            );
        }

        /**
         * @var Bundle $bundle
         */
        $bundle = $bundles[$resolvedNamespace[0]];
        $bundleNamespace = $bundle->getNamespace();
        $namespace = $bundleNamespace . '\\Entity\\' . $resolvedNamespace[1];

        if (!class_exists($namespace)) {
            throw new ClassNotFoundException(
                $namespace,
                new ErrorException()
            );
        }

        /**
         * Otherwise, assume that class is namespace of class.
         */

        return $namespace;
    }
407175
public function getTemplatePath($namespace = null)
    {
        if (null !== $namespace && ! is_string($namespace)) {
            throw new Exception\InvalidNamespaceException('Namespace must be a string');
        }

        $namespace = $namespace ?: self::DEFAULT_NAMESPACE;

        if (! array_key_exists($namespace, $this->paths)) {
            $this->paths[$namespace] = new SplStack;
        }

        return $this->paths[$namespace];
    }
1059146
public function toNamespacedString($namespace, array $aliased_classes, $this_class, $use_phpdoc_format)
    {
        $base_value = $this instanceof TNamedObject
            ? parent::toNamespacedString($namespace, $aliased_classes, $this_class, $use_phpdoc_format)
            : $this->value;

        if ($base_value === 'non-empty-array') {
            $base_value = 'array';
        }

        if ($use_phpdoc_format) {
            if ($this instanceof TNamedObject || $this instanceof TIterable) {
                return $base_value;
            }

            $value_type = $this->type_params[1];

            if ($value_type->isMixed()) {
                return $base_value;
            }

            $value_type_string = $value_type->toNamespacedString($namespace, $aliased_classes, $this_class, true);

            if (!$value_type->isSingle()) {
                return '(' . $value_type_string . ')[]';
            }

            return $value_type_string . '[]';
        }

        $extra_types = '';

        if ($this instanceof TNamedObject && $this->extra_types) {
            $extra_types = '&' . implode(
                '&',
                array_map(
                    /**
                     * @return string
                     */
                    function (Atomic $extra_type) use ($namespace, $aliased_classes, $this_class) {
                        return $extra_type->toNamespacedString($namespace, $aliased_classes, $this_class, false);
                    },
                    $this->extra_types
                )
            );
        }

        return $base_value .
                '<' .
                implode(
                    ', ',
                    array_map(
                        /**
                         * @return string
                         */
                        function (Union $type_param) use ($namespace, $aliased_classes, $this_class) {
                            return $type_param->toNamespacedString($namespace, $aliased_classes, $this_class, false);
                        },
                        $this->type_params
                    )
                ) .
                '>' . $extra_types;
    }
388433
public function addVersion(string $code, string $namespace, bool $default = false)
    {
        $this->supportedVersions[$code] = $namespace;

        if (is_null($this->defaultVersion) || $default === true) {
            $this->setDefaultVersion($code);
        }

        return $this;
    }
415312
public static function create($namespace = null, $name = null)
    {
        if (null === $namespace) {
            return self::createNamespacelessUuid();
        }

        return self::createNamespacedUuid($namespace, $name);
    }
960430
public function withNameSpace($namespace)
    {
        $namespace = (string) $namespace;

        if (! isset(static::$namespaces[$namespace])) {
            $new = clone $this;
            $new->setNamespace($namespace);
            $new->setEnabled($this->enabled);
            static::$namespaces[$namespace] = $new;
        }

        return static::$namespaces[$namespace];
    }
1023734
private function fetchResultForNamespace($template, $namespace)
    {
        foreach ($this->getPath($namespace) as $path) {
            if (! empty($path)) {
                $path .= '/';
            }
            $filename = $path . $template;
            $contents = @file_get_contents($filename);
            if ($contents !== false) {
                $key = $namespace . '::' . $template;
                return new Result($key, $contents, false, $this->isCompiled());
            }
        }
        return null;
    }
382779
public function getBatch($namespace)
    {
        if (!$this->finalized) {
            $this->autoFinalize();
        }
        $full = $this->getAll();
        if (!isset($full[$namespace])) {
            $this->triggerError(
                'Cannot retrieve undefined namespace ' .
                htmlspecialchars($namespace),
                E_USER_WARNING
            );
            return;
        }
        return $full[$namespace];
    }
221580
protected function getNamespace($alias, $default = false)
    {
        $result = isset($this->namespaces[$alias]) ? $this->namespaces[$alias] : [];

        if ($result || $default) {
            $result = array_merge($this->getDefaultGroups(), $result);
        }

        return $result;
    }
196100
function(namespace) {
            var ncache = {};
            _.each(cache_methods, function(method) {
                ncache[method] = _.partial(Cache[method], namespace);
            })
            return ncache;
        }
812914
public function setCache($cache, $namespace = null)
    {
        if($cache && ClassRegistryCache::isSupported())
        {
            $this->__registry = new ClassRegistryCache();

            if($namespace) {
                $this->__registry->setNamespace($namespace);
            }
        }
        else
        {
            if(!$this->__registry instanceof ClassRegistry) {
                $this->__registry = new ClassRegistry();
            }
        }

        return $this;
    }
1325847
public function getPrefixForNamespace( $namespace )
	{
		if (
			  ! isset( $this->cacheNamespaces ) ||
			  count( $this->cacheNamespaces ) != count( $this->instance_namespaces )
		   )
		{
			$this->cacheNamespaces = array_flip( $this->instance_namespaces );
			// If the default namespace is one of the standards ones then the prefix may be missing
			$standardNamespaces = array_flip( XBRL_Constants::$standardPrefixes );
			if ( isset( $this->instance_namespaces[''] ) )
			{
				if ( isset( $standardNamespaces[ $this->instance_namespaces[''] ] ) )
				{
					$this->cacheNamespaces[ $this->instance_namespaces[''] ] = $standardNamespaces[ $this->instance_namespaces[''] ];
				}
			}
		}

		return isset( $this->cacheNamespaces[ $namespace ] )
			? $this->cacheNamespaces[ $namespace ]
			: false;
	}
90779
public function toPhpString(
        $namespace,
        array $aliased_classes,
        $this_class,
        $php_major_version,
        $php_minor_version
    ) {
        if ($this->value === 'static') {
            return null;
        }

        return $this->toNamespacedString($namespace, $aliased_classes, $this_class, false);
    }
422169
public function load($locale, $group, $namespace = null)
	{
		if (is_null($namespace) || $namespace == '*')
		{
			return $this->loadData($locale, $group);
		}

		return $this->loadNamespaced($locale, $group, $namespace);
	}
1174445
protected function getCacheDriver($cacheNamespace, CacheProvider $cacheDriver = null)
    {
        if (!$cacheDriver instanceof CacheProvider) {
            $cacheDriver = clone $this->getMetadataCacheDriver();
            $cacheDriver->setNamespace($cacheNamespace);
        }

        if ($cacheDriver->getNamespace() === '') {
            $cacheDriver->setNamespace($cacheNamespace);
        }

        return $cacheDriver;
    }
605455
public function read($hash, $namespace = null)
    {
        if ($this->cacheProvider instanceof iNamespacedCache) {
            return $this->cacheProvider->read($hash, $namespace);
        }

        return $this->cacheProvider->read($hash);
    }