Members
(static) dependencies :Array.<string>
Class dependencies:
['app']
.
actionPattern :RegExp
Action pattern for qualified action.
namespaceSeparator :string
Controller namespace separator.
coreNamespace :string
The namespace for core controllers.
Methods
add(name, controller)
Add a controller binding.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The controller name. |
controller |
http.controllers.Controller | The controller class. |
Returns:
The current controller repository instance.
get(name)
Get the controller instance by name.
If it was not registered into the repository, it will attempt to find it in the application folder.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The controller name. |
Returns:
The controller instance.
has(name)
Check if the given controller was registered.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The controller name. |
Returns:
Indicates that the controller name was already registered into the repository.
- Type
- boolean
group(name, group)
Group controllers inside a given namespace.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The group namespace. |
group |
function | The controller group closure. |
Returns:
The current controller repository instance.
getFromPath(controllerPath, name)
Make controller instance from base path and controller name.
Mainly relies on path structure and file name.
Parameters:
Name | Type | Description |
---|---|---|
controllerPath |
string | The controller file path. |
name |
string | The controller name. |
Returns:
The resolved controller instance.
buildName(name)
Resolve the name based on current groups and given name.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The base name. |
Returns:
The resolved, fully qualified, name.
- Type
- string
getName(name, withActionopt)
Get the name that is used for container binding.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
name |
string | The controller name. | ||
withAction |
boolean |
<optional> |
false
|
Indicates that the returned value should contain the action. |
Returns:
The controller name into toe container.
- Type
- string
resolveName(name)
Get controller name without container prefix or action.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The controller action. |
Returns:
The controller name without the action method.
- Type
- string
resolveAction(name)
Get the action from the given qualified controller name.
Example
this.resolveAction('PostController@show'); // 'show'
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The controller action. |
Returns:
The controller method name, without the controller name.
- Type
- string