@absolunet/ioc2.1.0

View on GitHub

Resolver

View file resolver. It allows to resolve path of a given view name.

Members

(static) dependencies :Array.<string>

Source:
Class dependencies: ['app', 'config', 'file'].

extensions :Array.<string>

Source:
The supported file extensions.

namespaceDelimiter :string

Source:
The namespace delimiter.

Methods

find(view)

Source:
Find view path by name.
Parameters:
Name Type Description
view string The view name.
Throws:
Indicates that the given view was not found.
Type
TypeError
Returns:
The view content.
Type
string

exists(view)

Source:
Check if view file exists by name.
Parameters:
Name Type Description
view string The view name.
Returns:
Indicates that the view file exists and may be rendered.
Type
boolean

getViewPath(view)

Source:
Get view path by name.
Parameters:
Name Type Description
view string The view name.
Returns:
The found view path, or null if not found.
Type
string | null

getViewPaths(view)

Source:
Get view possible paths by name.
Parameters:
Name Type Description
view string The view name.
Returns:
The possible view file paths.
Type
Array.<string>

getViewBasePaths(view)

Source:
Get base path of the given view based on the namespace if present.
Parameters:
Name Type Description
view string The view name.
Throws:
Indicates that the given view namespace was not found.
Type
TypeError
Returns:
The view folder paths.
Type
Array.<string>

namespace(namespace, folder)

Source:
Register views namespace.
Parameters:
Name Type Description
namespace string The namespace.
folder string The folder.
Returns:
The current resolver instance.
Type
view.services.Resolver

addPath(path)

Source:
Add possible views path.
Parameters:
Name Type Description
path string The new views path.
Returns:
The current resolver instance.
Type
view.services.Resolver

getBasePaths()

Source:
Get all views base paths.
Returns:
The view base paths.
Type
Array.<string>