src/mako/common/traits/NamespacedFileLoaderTrait.php
protected function getFilePath(string $file, ?string $extension = null, ?string $suffix = null): string
	{
		if(strpos($file, '::') === false)
		{
			// No namespace so we'll just use the default path

			$path = $this->path;
		}
		else
		{
			// The file is namespaced so we'll use the namespace path

			[$namespace, $file] = explode('::', $file, 2);

			if(!isset($this->namespaces[$namespace]))
			{
				throw new RuntimeException(vsprintf('The [ %s ] namespace does not exist.', [$namespace]));
			}

			$path = $this->namespaces[$namespace];
		}

		// Append suffix to path if needed

		if($suffix !== null)
		{
			$path .= DIRECTORY_SEPARATOR . $suffix;
		}

		// Return full path to file

		return $path . DIRECTORY_SEPARATOR . str_replace('.', DIRECTORY_SEPARATOR, $file) . ($extension ?? $this->extension);
	}
protected function getFilePath(string $file, ?string $extension = null, ?string $suffix = null): string
	{
		if(strpos($file, '::') === false)
		{
			// No namespace so we'll just use the default path

			$path = $this->path;
		}
		else
		{
			// The file is namespaced so we'll use the namespace path

			[$namespace, $file] = explode('::', $file, 2);

			if(!isset($this->namespaces[$namespace]))
			{
				throw new RuntimeException(vsprintf('The [ %s ] namespace does not exist.', [$namespace]));
			}

			$path = $this->namespaces[$namespace];
		}

		// Append suffix to path if needed

		if($suffix !== null)
		{
			$path .= DIRECTORY_SEPARATOR . $suffix;
		}

		// Return full path to file

		return $path . DIRECTORY_SEPARATOR . str_replace('.', DIRECTORY_SEPARATOR, $file) . ($extension ?? $this->extension);
	}
protected function getFilePath ( string $ file , ? string $ extension = null , ? string $ suffix = null ) : string { if ( strpos ( $ file , '::' ) === false ) { // No namespace so we'll just use the default path $ path = $ this -> path ; } else { // The file is namespaced so we'll use the namespace path [ $ namespace , $ file ] = explode ( '::' , $ file , 2 ) ; if ( ! isset ( $ this -> namespaces [ $ namespace ] ) ) { throw new RuntimeException ( vsprintf ( 'The [ %s ] namespace does not exist.' , [ $ namespace ] ) ) ; } $ path = $ this -> namespaces [ $ namespace ] ; } // Append suffix to path if needed if ( $ suffix !== null ) { $ path .= DIRECTORY_SEPARATOR . $ suffix ; } // Return full path to file return $ path . DIRECTORY_SEPARATOR . str_replace ( '.' , DIRECTORY_SEPARATOR , $ file ) . ( $ extension ?? $ this -> extension ) ; }
Returns the path to the file.

@param  string            $file      File name
@param  string|null       $extension File extension
@param  string|null       $suffix    Path suffix
@throws \RuntimeException
@return string
Returns the path to the file .