Get the namespace for the mock.

@param string $request
@param array|string $options
@return string
496161
protected function _namespace($request, $options = []) {
		$request->params['command'] = $request->action;
		return parent::_namespace($request, ['prepend' => 'tests.mocks.']);
	}
493800
protected function _use($request) {
		$request->params['command'] = 'model';
		return $this->_namespace($request) . '\\' . $this->_model($request);
	}
751615
private function getNamespaceByName(Project $project, $name): Namespace_
    {
        $existingNamespaces = $project->getNamespaces();

        if (isset($existingNamespaces[$name])) {
            return $existingNamespaces[$name];
        }

        $namespace = new Namespace_(new Fqsen($name));
        $project->addNamespace($namespace);
        return $namespace;
    }
1068825
def get_namespace_by_url(self, url: str) -> Optional[Namespace]:
        """"""
        return self.session.query(Namespace).filter(Namespace.url == url).one_or_none()
464612
public function render(Request $request, array $options = array())
    {
        $provider = isset($options['provider']) ? $this->getProvider($options['provider']) : $this->getDefaultProvider();
        unset($options['provider']);

        return $provider->render($request, $options);
    }
967646
protected function getNamespace($namespace = null)
    {
        if (!is_null($namespace)) {
            $parts = explode('\\', $namespace);

            array_pop($parts);

            return join('\\', $parts);
        }

        return $this->getAppNamespace() . $this->namespace;
    }
1356300
private function getWebspaceAndLanguage(Request $request)
    {
        $webspaceKey = $this->getRequestParameter($request, 'webspace', true);
        $languageCode = $this->getRequestParameter($request, 'language', true);

        return [$webspaceKey, $languageCode];
    }
819115
public static function getQueryString(Request $request): ?string
    {
        $qs = $request->server->get('QUERY_STRING', '');
        if ('' === $qs) {
            return null;
        }

        $parts = [];

        foreach (explode('&', $qs) as $param) {
            if ('' === $param || '=' === $param[0]) {
                // Ignore useless delimiters, e.g. "x=y&".
                // Also ignore pairs with empty key, even if there was a value, e.g. "=value", as such nameless values cannot be retrieved anyway.
                // PHP also does not include them when building _GET.
                continue;
            }

            $keyValuePair = explode('=', $param, 2);

            // GET parameters, that are submitted from a HTML form, encode spaces as "+" by default (as defined in enctype application/x-www-form-urlencoded).
            // PHP also converts "+" to spaces when filling the global _GET or when using the function parse_str. This is why we use urldecode and then normalize to
            // RFC 3986 with rawurlencode.
            $parts[] = isset($keyValuePair[1]) ?
                rawurlencode(urldecode($keyValuePair[0])).'='.rawurlencode(urldecode($keyValuePair[1])) :
                rawurlencode(urldecode($keyValuePair[0]));
        }

        return implode('&', $parts);
    }
76706
static function getName($namespace,$folder = ''){

		// is namespace empty?
		if($namespace == ''){
			user_error('No Namespace');
			exit;
		}
		self::setEnvironment();
		
		// check environment have data?
		if(count(self::$env) == 0){
			user_error('Environment Registry is empty');
			exit;
		}
		
		$segments = preg_split('/(\.|\\\\)/',$namespace);
		$appname = $segments[0];

		if($folder !== ''){
			array_splice($segments,1,0,[$folder]);
		}

		$path = VENDOR_PATH;

		if(isset(self::$env[$appname])){
			$path = self::$env[$appname];	
		}
		
		// remove first array
		array_shift($segments);

		$p = implode(DS,$segments);

		$name = (object)[
			'app' => $appname,
			'namespace' => '\\'.$appname.'\\'.str_replace('/','\\',$p),
			'class' => end($segments),
			'path' => $path . $p. '.php',
			'segments' => $segments
		];
		return $name;
	}
1287089
public function getNamespace(): string
    {
        // Check cache.
        if (null === $this->namespace) {
            $tokens = $this->getTokenStream();
            // Find namespace token
            try {
                $loc = $tokens->scan(0, [T_NAMESPACE]);
            } catch (\OutOfBoundsException $e) {
                return $this->namespace = '';
            }

            // Get the next token (start with namespace)
            if ($loc !== null) {
                $loc = $tokens->next($loc);
            }

            // If the start of the namespace is found,
            // parse it, otherwise save empty namespace.
            $this->namespace = '';
            if ($loc !== null) {
                $this->namespace = $this->parseNamespace($loc);
            }
        }

        return $this->namespace;
    }
543510
public function getNamespace($namespace, $documentsDirectory = null)
    {
        if (!$documentsDirectory) {
            $documentsDirectory = $this->documentDir;
        }

        if (strpos($namespace, ':') !== false) {
            list($bundle, $document) = explode(':', $namespace);
            $bundle = $this->getBundleClass($bundle);

            // If bundle has a sub-namespace it needs to be replaced
            if (strpos($documentsDirectory, '\\')) {
                $bundleSubNamespace = substr(
                    $bundle,
                    $start = strpos($bundle, '\\') + 1,
                    strrpos($bundle, '\\') - $start + 1
                );

                $documentsDirectory = str_replace(
                    $bundleSubNamespace,
                    '',
                    $documentsDirectory
                );
            }

            $namespace = substr($bundle, 0, strrpos($bundle, '\\')) . '\\' .
                $documentsDirectory . '\\' . $document;
        }

        return $namespace;
    }
1162215
public function optionsAction(Request $request)
    {
        $response = $this->response;
        $response->setStatusCode(Response::HTTP_NO_CONTENT);
        $request->attributes->set('corsMethods', 'GET, OPTIONS');

        return $response;
    }
1112926
protected function _class($request) {
		$type = $request->action;
		$name = $request->args();

		if ($command = $this->_instance($type)) {
			$request->params['action'] = $name;
			$name = $command->invokeMethod('_class', [$request]);
		}
		return "Mock{$name}";
	}
90470
public function getNamespace($ns) {
    $namespaces = $this
      ->getNamespaces()
      ->filter(function(NamespaceNode $node) use ($ns) {
        return $node->getName()->getPath() === $ns;
      });

    return $namespaces->isEmpty() ? NULL : $namespaces[0];
  }
884668
protected function getRequestsNamespace($path)
    {
        $path = str_finish($path, '\\');

        $path = Helpers::getAppNamespace() . Config::getRequestsPath($path);

        return rtrim(Helpers::convertSlashToBackslash($path), '\\');
    }
1309750
protected function getRequestClass($request)
    {
        $parts = explode('\\', $request);
        $lastIndex = count($parts) - 1;

        switch ($parts[$lastIndex]) {
            case 'Void':
                $parts[$lastIndex] = 'Cancel';
                break;
            case 'AVS':
            case 'INPay':
            case 'ABNiDEAL':
                $this->throwDeprecatedTransactionType();
                break;
            case 'Payin':
            case 'Payout':
                if ($this->getParentClass($parts, $lastIndex) === 'Citadel') {
                    $this->throwDeprecatedTransactionType();
                }
                break;
            case 'oBeP':
                if ($this->getParentClass($parts, $lastIndex) === 'PayByVouchers') {
                    $this->throwDeprecatedTransactionType();
                }
                break;
        }

        return sprintf(
            '\Genesis\API\Request\%s',
            implode('\\', $parts)
        );
    }
30039
protected function bindToNamespace($request, $url, $namespace)
    {
        $array  = explode('|', $url, 3);
        $class  = !empty($array[0]) ? $array[0] : $this->router->config('default_controller');
        $method = !empty($array[1]) ? $array[1] : $this->router->config('default_action');
        $param  = [];

        if (!empty($array[2])) {
            $this->parseUrlParams($request, $array[2], $param);
        }

        return new CallbackDispatch($request, $this, [$namespace . '\\' . Loader::parseName($class, 1), $method], $param);
    }