Gets the model's namespace.

@param string $modelName
@param string $modelDirectory

@return string
181385
protected function getNamespace($modelName, $modelDirectory)
    {
        $namespace = Helpers::getAppNamespace() . Config::getModelsPath($modelDirectory);

        return rtrim(Helpers::convertSlashToBackslash($namespace), '\\');
    }
302757
public static function modelAlias($className = null)
    {
        if (is_null($className)) {
            $className = get_called_class();
        } elseif (is_object($className)) {
            $className = get_class($className);
        }
        if (!strncmp($className, ':', 1)) {
            // already an alias
            return $className;
        }
        $class = new ReflectionClass($className);
        if ($class->getNamespaceName() === 'app\models') {
            return ':app\\' . $class->getShortName();
        } elseif (($alias = array_search($class->getNamespaceName(), Yii::$app->modelAliases)) !== false) {
            return $alias . '\\' . $class->getShortName();
        }

        return $className;
    }
1264923
protected function parseClassName(string $name, string $moduleDirectory = null): string
    {
        $rootNamespace = $this->laravel->getNamespace();

        if (Str::startsWith($name, $rootNamespace)) {
            return $name;
        }

        if (Str::contains($name, '/')) {
            $name = str_replace('/', '\\', $name);
        }

        return $this->parseClassName(
            trim($rootNamespace, '\\') . '\\' . $moduleDirectory . '\\' . $name
        );
    }
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;
    }
458849
public function getRouteNameForModelClass($modelClass, $prefix = false)
    {
        $modelSlug = static::MODEL_ROUTE_NAME_PREFIX
                   . $this->getRouteSlugForModelClass($modelClass);

        if ( ! $prefix) {
            return $modelSlug;
        }

        return config('cms-core.route.name-prefix')
             . config('cms-models.route.name-prefix')
             . $modelSlug;
    }
925111
public function getModelDirectory()
	{
		if ($this->_modelDirectory && !file_exists($this->_modelDirectory))
			throw new ConfigException('Invalid or non-existent directory: '.$this->_modelDirectory);

		return $this->_modelDirectory;
	}
531787
public function getData($namespace = null)
    {
        if(!self::$pluginData) {
            // try to find the model via namespace
            if (!$namespace) {
                // if we are in a model
                if (property_exists($this, 'namespace')) {
                    self::$pluginData = $this;
                } /// When calling the method from a parent class that uses this class as a parent
                else {
                    // try to find plugin's model via reflection class
                    try{
                        $reflector = new \ReflectionClass(self::class);
                        $fn = $reflector->getFileName();
                        $explode = explode('plugins/', str_replace('\\', '/', dirname($fn)));
                        if (isset($explode[1])) {
                            $pluginNamespace = str_replace('/Controllers', '', $explode[1]);
                            self::$pluginData = Plugin::where('namespace', $pluginNamespace)->first();
                        }

                    }catch(\Exception $e){
                        return null;
                    }
                }
            }else {
                // Return a requested plugin
                self::$pluginData = $this->getByNamespace($namespace);
            }
        }

        if (!self::$pluginData) {
            return null;
        }

        return self::$pluginData;
    }
684009
public function getSingularNamespacedName(string $entityFqn, array $subDirectories): string
    {
        $singular = \ucfirst(MappingHelper::getSingularForFqn($entityFqn));

        return $this->getNamespacedName($singular, $subDirectories);
    }
605434
protected function getSessionNamespace($name = null) {
		if ($name === null) {
			$name = str_replace('\\', '_', get_class($this));
		}
		
		if (isset($this->_namespacesInstances[$name])) {
			return $this->_namespacesInstances[$name];
		}
		
		$namespace = $this->getNamespaceFactory()->createNamespace($name);
		
		$this->_namespacesInstances[$name] = $namespace;
		return $namespace;
	}
17965
protected function getModelNamespace($modelName)
    {
        $path = Helpers::getAppNamespace() . rtrim(Config::getModelsPath(), '\\');

        return $path . '\\' . $modelName;
    }
1171963
function preserveNamespace (models) {
    const prefixedModels = {}
    if (connector.config.skipModelNamespace) {
      // if namspace is not applied we do not need to preserve it
      return models
    } else {
      for (var model in models) {
        prefixedModels[models[model].name] = models[model]
      }
      return prefixedModels
    }
  }
276563
public static function makeFormRequestName($modelName)
    {
        $name = self::getProperCaseFor($modelName, 'request-form-name');
        $case = ucfirst(camel_case($name));

        if (!empty($postFix = Config::getFormRequestNamePostFix())) {
            return str_finish($case, $postFix);
        }

        return $case;
    }
737379
private function getOriginalPropertyName($propertyName, ModelIdInterface $modelId)
    {
        $originalPropertyName =
            \trim(\substr($propertyName, \strlen(\str_replace('::', '____', $modelId->getSerialized()) . '_')), '[]');

        return $originalPropertyName ?: null;
    }
475116
private function namespaceName() {
    $node = new NameNode();
    $this->mustMatch(T_STRING, $node, NULL, TRUE);
    while ($this->tryMatch(T_NS_SEPARATOR, $node)) {
      $this->mustMatch(T_STRING, $node, NULL, TRUE);
    }
    return $node;
  }
657877
public ModelService getModelService(String serviceName){
        ModelService service = getDirectoryServiceClient().getService(serviceName, null);
        return service;
    }
1048736
protected function _getNamespace($className, $pluginPath = null, $prefixPath = null)
    {
        $namespace = preg_replace('/(.*)Controller\//', '', $className);
        $namespace = preg_replace('/\//', '\\', $namespace);
        $namespace = preg_replace('/\.php/', '', $namespace);
        $prefixPath = preg_replace('/\//', '\\', Inflector::camelize($prefixPath));
        if (!$pluginPath) {
            $rootNamespace = Configure::read('App.namespace');
        } else {
            $rootNamespace = preg_replace('/\//', '\\', $pluginPath);
        }
        $namespace = [
            $rootNamespace,
            'Controller',
            $prefixPath,
            $namespace
        ];

        return implode('\\', Hash::filter($namespace));
    }
114387
final public function getNamespace(): string
    {
        if (null === $this->namespace) {
            $pos             = strrpos(static::class, '\\');
            $this->namespace = false === $pos ? '' : substr(static::class, 0, $pos);
        }

        return $this->namespace;
    }