src/app/n2n/core/module/ModuleManager.php
public function getModuleOfTypeName(string $typeName, bool $required = true) {
		$typeName = trim($typeName, '\\');
		
		$module = null;
		$nsLength = 0;
		foreach ($this->modules as $curNamespace => $curModule) {
			if (!StringUtils::startsWith($curNamespace . '\\', $typeName)) continue;
			
			$curNsLength = strlen($curNamespace);
			if ($curNsLength > $nsLength) {
				$module = $curModule;
				$nsLength = $curNsLength;
			}
		}
		
		if (!$required || $module !== null) return $module;
				
		throw new UnknownModuleException('Type is not part of any installed modules: ' . $typeName);
	}
public function getModuleOfTypeName(string $typeName, bool $required = true) {
		$typeName = trim($typeName, '\\');
		
		$module = null;
		$nsLength = 0;
		foreach ($this->modules as $curNamespace => $curModule) {
			if (!StringUtils::startsWith($curNamespace . '\\', $typeName)) continue;
			
			$curNsLength = strlen($curNamespace);
			if ($curNsLength > $nsLength) {
				$module = $curModule;
				$nsLength = $curNsLength;
			}
		}
		
		if (!$required || $module !== null) return $module;
				
		throw new UnknownModuleException('Type is not part of any installed modules: ' . $typeName);
	}
public function getModuleOfTypeName ( string $ typeName , bool $ required = true ) { $ typeName = trim ( $ typeName , '\\' ) ; $ module = null ; $ nsLength = 0 ; foreach ( $ this -> modules as $ curNamespace => $ curModule ) { if ( ! StringUtils :: startsWith ( $ curNamespace . '\\' , $ typeName ) ) continue ; $ curNsLength = strlen ( $ curNamespace ) ; if ( $ curNsLength > $ nsLength ) { $ module = $ curModule ; $ nsLength = $ curNsLength ; } } if ( ! $ required || $ module !== null ) return $ module ; throw new UnknownModuleException ( 'Type is not part of any installed modules: ' . $ typeName ) ; }
Returns the module which the passed type is part of.
@param string $typeName
@param bool $required
@throws UnknownModuleException if $required is true and type is not part of any module.
@return Module or null if $required is false and type is not part of any module.
Returns the module which the passed type is part of .