Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'feature/map-placeholders' into develop

  • Loading branch information...
commit cc42135dc669f5f70d87cbb7fec77058ba1ef945 2 parents 884bc62 + 1777cd6
@trq trq authored
Showing with 10 additions and 6 deletions.
  1. +10 −6 lib/Proem/Dispatch/Standard.php
View
16 lib/Proem/Dispatch/Standard.php
@@ -45,9 +45,11 @@ class Standard implements Template
const DEFAULT_CONTROLLERMAP_PRIORITY = 0;
/**
- * Action placeholder
+ * Placeholders
*/
- const ACTION_PLACEHOLDER = '{:action}';
+ const MODULE_PLACEHOLDER = '{:module}';
+ const CONTROLLER_PLACEHOLDER = '{:controller}';
+ const ACTION_PLACEHOLDER = '{:action}';
/**
* Store the Assets manager
@@ -119,7 +121,7 @@ public function __construct(Manager $assets)
$this->assets = $assets;
$this->controllerMaps = new Queue;
$this->controllerMaps->insert(
- 'Module\:module\Controller\:controller',
+ 'Module\\' . self::MODULE_PLACEHOLDER . '\Controller\\' . self::CONTROLLER_PLACEHOLDER,
self::DEFAULT_CONTROLLERMAP_PRIORITY
);
$this->actionMap = self::ACTION_PLACEHOLDER . 'Action';
@@ -209,8 +211,10 @@ public function getAction()
* This method allows us to add different directory structures
* which the dispatcher can use to locate controllers.
*
- * The default controller map looks like: 'Module\:module\Controller\:controller' and
- * is stored at priority 0.
+ * The default controller map looks like: 'Module\{:module}\Controller\{:controller}' where
+ * {:module} and {:controller} are respectfully replaced by data provided by the payload.
+ *
+ * This controller map is injected with a priority of 0.
*
* If you want custom controller maps to be looked at before the default controller map,
* give them a higher priority.
@@ -260,7 +264,7 @@ public function isDispatchable()
{
foreach (array_reverse($this->controllerMaps) as $map) {
$this->class = str_replace(
- [':module', ':controller'],
+ [self::MODULE_PLACEHOLDER, self::CONTROLLER_PLACEHOLDER],
[$this->module, $this->controller],
$map
);
Please sign in to comment.
Something went wrong with that request. Please try again.