This commit is contained in:
Simon Sessingø
2016-11-15 06:38:39 +01:00
parent 669d318a12
commit 9c413a3c53
5 changed files with 33 additions and 44 deletions
+2 -24
View File
@@ -26,24 +26,11 @@ abstract class RouterEntry {
'requestMethods' => array(),
'where' => array(),
'parameters' => array(),
'middleware' => array(),
];
protected $callback;
/**
* Returns callback name/identifier for the current route based on the callback.
* Useful if you need to get a unique identifier for the loaded route, for instance
* when using translations etc.
*
* @return string
*/
public function getIdentifier() {
if(strpos($this->callback, '@') !== false) {
return $this->callback;
}
return 'function_' . md5($this->callback);
}
/**
* @param string $callback
* @return static
@@ -86,21 +73,12 @@ abstract class RouterEntry {
return $this;
}
/**
* @param string $prefix
* @return static
*
public function setPrefix($prefix) {
$this->settings['prefix'] = '/' . ltrim($prefix, '/');
return $this;
}*/
/**
* @param string $middleware
* @return static
*/
public function setMiddleware($middleware) {
$this->settings['middleware'] = $middleware;
$this->settings['middleware'][] = $middleware;
return $this;
}