* @namespace Array **
334867
function arrayIndexOf(arr, search, fromIndex, fromRight) {
  var length = arr.length, defaultFromIndex, index, increment;

  increment = fromRight ? -1 : 1;
  defaultFromIndex = fromRight ? length - 1 : 0;
  fromIndex = trunc(fromIndex);
  if (!fromIndex && fromIndex !== 0) {
    fromIndex = defaultFromIndex;
  }
  if (fromIndex < 0) {
    fromIndex = length + fromIndex;
  }
  if ((!fromRight && fromIndex < 0) || (fromRight && fromIndex >= length)) {
    fromIndex = defaultFromIndex;
  }

  index = fromIndex;

  while((fromRight && index >= 0) || (!fromRight && index < length)) {
    if (!(index in arr)) {
      return sparseIndexOf(arr, search, fromIndex, fromRight);
    }
    if (isArrayIndex(index) && arr[index] === search) {
      return index;
    }
    index += increment;
  }
  return -1;
}
1157320
protected static function _toArray($xml, &$parentData, $ns, $namespaces)
    {
        $data = [];

        foreach ($namespaces as $namespace) {
            foreach ($xml->attributes($namespace, true) as $key => $value) {
                if (!empty($namespace)) {
                    $key = $namespace . ':' . $key;
                }
                $data['@' . $key] = (string)$value;
            }

            foreach ($xml->children($namespace, true) as $child) {
                static::_toArray($child, $data, $namespace, $namespaces);
            }
        }

        $asString = trim((string)$xml);
        if (empty($data)) {
            $data = $asString;
        } elseif (strlen($asString) > 0) {
            $data['@'] = $asString;
        }

        if (!empty($ns)) {
            $ns .= ':';
        }
        $name = $ns . $xml->getName();
        if (isset($parentData[$name])) {
            if (!is_array($parentData[$name]) || !isset($parentData[$name][0])) {
                $parentData[$name] = [$parentData[$name]];
            }
            $parentData[$name][] = $data;
        } else {
            $parentData[$name] = $data;
        }
    }
685882
public function getNamespace()
    {
        $class       = array();
        $inNamespace = false;

        foreach ($this->tokenlist as $key => $token) {
            if (T_NAMESPACE === $token[0]) {
                $inNamespace = true;
                continue;
            }
            if (T_STRING === $token[0] && $inNamespace) {
                $class[] = $token[1];

            }
            if (';' === $token && $inNamespace) {
                return $class;
            }
        }

        return array();
    }
538805
public function addNamespaces(array $namespaces): void
    {
        //loop for add single namespace
        foreach ($namespaces as $namespace) {

            // normalize namespace prefix
            $prefix = \trim($namespace[0], '\\');

            // normalize the base directory with a trailing separator
            $baseDir = \rtrim($namespace[1], DIRECTORY_SEPARATOR).'/';

            //add namespace
            $this->prefixes[$prefix] = $baseDir;
        }
    }
444791
def namespace_attributes(ns)
      Hash[ns.map do |prefix, uri|
             if prefix==""
               ["xmlns", uri]
             else
               [["xmlns", prefix].join(":"), uri]
             end
           end]
    end
1089578
static function setCache($namespace)
    {
        $cacheData = [];
        $data = CommonConfigModel::getConfigByNamespace($namespace);
        foreach ($data as $key => $value) {
            $cacheData[$value['name']] = [
                'value'=>self::_getInfo($value['vtype'], $value['value']),
                'issystem'=>$value['issystem'],
                'desc'=>$value['desc']
            ];
        }
        $cacheName = 'config:'.$namespace;
        Cache::forever($cacheName, $cacheData);
        return $cacheData;
    }
373219
public function registerComposerNamespaces(array $namespaces) {
		foreach ($namespaces as $namespace => $dirs) {
			$namespaceDir = trim($namespace, '\ ');
			$namespaceDir = str_replace('\\', DIRECTORY_SEPARATOR, $namespaceDir);
			
			foreach ($dirs as $dir) {
				$dir .= DIRECTORY_SEPARATOR . $namespaceDir;
				
				$this->registerNamespace($namespace, $dir);
			}
		}
		
		return $this;
	}
976362
public function addNamespace($name)
    {
        if (!Arr::in($name, self::$_namespace)) {
            self::$_namespace[] = $name;
            return true;
        }

        return false;
    }
767778
public function registerNamespaces($namespaces)
    {
        if (!is_array($namespaces) && !$namespaces instanceof Traversable) {

            throw new Zend_Loader_Exception_InvalidArgumentException('Namespace pairs must be either an array or Traversable');
        }

        foreach ($namespaces as $namespace => $directory) {
            $this->registerNamespace($namespace, $directory);
        }
        return $this;
    }
917747
private static function classBelongsToNamespace($className, $namespaces)
    {
        $belongsToNamespace = false;
        $check = array_values($namespaces);
        $lcClassName = strtolower(ltrim($className, '\\'));

        foreach ($check as $namespace) {
            if (false !== strpos($lcClassName, strtolower($namespace))) {
                $belongsToNamespace = true;
                continue;
            }
        }
        return $belongsToNamespace;
    }
110691
protected function retrieveNamespaces() {
		if ( is_array( $this->namespaces ) ) {
			return;
		}
		$params = [ 'meta' => 'siteinfo', 'siprop' => 'namespaces' ];
		$namespaces = $this->api->getRequest( new SimpleRequest( 'query', $params ) );
		if ( isset( $namespaces['query']['namespaces'] ) ) {
			$this->namespaces = $namespaces['query']['namespaces'];
		}
	}
896297
public function AllNamespaces()
	{
		// In PHP 7.0 $this is passed to closure functions automatically but not in earlier versions
		$contexts = &$this->contexts;
		$instance = &$this->instance;

		$result = array_reduce( array_keys( $this->contexts ), function( $carry, $context ) use( &$contexts, &$instance ) {

			// The context may be invalid in which case exclude
			if ( ! isset( $contexts[ $context ]['entity']['segment']['explicitMember'] ) || count( $contexts[ $context ]['entity']['segment']['explicitMember'] ) == 0 )
				return $carry;

			// Each context may have more than one segment.  If the filter matches any one segment the context will be included.
			$context_segments = $instance->getElementsForContext( $context, true );

			foreach ( $context_segments as $key => $segment )
			{
				if ( ! isset( $segment['dimension']['namespace'] ) || isset( $carry[ $segment['dimension']['namespace'] ] ) ) continue;
				$carry[ $segment['dimension']['namespace'] ] = 1;

				if ( ! isset( $segment['member']['namespace'] ) || isset( $carry[ $segment['dimension']['namespace'] ] ) ) continue;
				$carry[ $segment['member']['namespace'] ] = 1;
			}

			return $carry;

		}, array() );

			return array_keys( $result );
	}
832073
static public function formatNamespace($namespace)
	{
	    if (is_array($namespace)) {
	        foreach ($namespace as $k => $v) {
	            $namespace[$k] =  static::formatNamespace($v);
	        }
	    } else {
	        $namespace = trim(str_replace('/', '\\', $namespace), '\\') . '\\';
	    }
	    
	    return $namespace;
	}
118785
function namespace() {
  var args = Array.prototype.slice.call(arguments);
  var setComponents = function(context, first, rest) {
    if(!context[first]) {
      context[first] = {
        models: {},
        collections: {},
        views: {},
      };
    }
    if(rest.length) {
      setComponents(context[first], _.first(rest), _.rest(rest));
    }
  };
  setComponents(window, _.first(args), _.rest(args));
}
342779
public function extractNamespace()
    {
        $namespaceParts = [];
        $tokens = token_get_all($this->phpCode);
        $numberOfTokens = count($tokens);
        for ($i = 0; $i < $numberOfTokens; $i++) {
            $token = $tokens[$i];
            if (is_string($token) || $token[0] !== T_NAMESPACE) {
                continue;
            }
            for (++$i; $i < $numberOfTokens; $i++) {
                $token = $tokens[$i];
                if (is_string($token)) {
                    break;
                }
                list($type, $value) = $token;
                if ($type === T_STRING) {
                    $namespaceParts[] = $value;
                    continue;
                }
                if ($type !== T_NS_SEPARATOR && $type !== T_WHITESPACE) {
                    break;
                }
            }
            break;
        }
        if ($namespaceParts === []) {
            return null;
        }
        return implode('\\', $namespaceParts);
    }
28030
public function namespaced($namespace, $attributes = [], Closure $callback = null): void
    {
        if ($attributes instanceof Closure) {
            $callback = $attributes;
            $attributes = [];
        }

        if (! empty($namespace) && $namespace != '\\') {
            $attributes['namespace'] = $namespace;
        }

        $attributes['middleware'] = \array_unique(\array_merge(
            $attributes['middleware'] ?? [], ['orchestra']
        ));

        $this->group('orchestra/foundation', 'orchestra', $attributes, $callback);
    }
678384
public function setNamespaces(array $namespaces)
    {
        $this->namespaces = array();

        foreach ($namespaces as $prefix => $uri) {
            $this->addNamespace($uri, $prefix);
        }

        return $this;
    }