[Routing] added hostname matching support to CompiledRoute
This commit is contained in:
parent
f4c05e3fe8
commit
23feb37a98
@ -22,6 +22,10 @@ class CompiledRoute
|
|||||||
private $tokens;
|
private $tokens;
|
||||||
private $staticPrefix;
|
private $staticPrefix;
|
||||||
private $regex;
|
private $regex;
|
||||||
|
private $pathVariables;
|
||||||
|
private $hostnameVariables;
|
||||||
|
private $hostnameRegex;
|
||||||
|
private $hostnameTokens;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
@ -30,13 +34,21 @@ class CompiledRoute
|
|||||||
* @param string $regex The regular expression to use to match this route
|
* @param string $regex The regular expression to use to match this route
|
||||||
* @param array $tokens An array of tokens to use to generate URL for this route
|
* @param array $tokens An array of tokens to use to generate URL for this route
|
||||||
* @param array $variables An array of variables
|
* @param array $variables An array of variables
|
||||||
|
* @param array $pathVariables An array of path variables
|
||||||
|
* @param array $hostnameVariables An array of hostname variables
|
||||||
|
* @param array $hostnameRegex Hostname regex
|
||||||
|
* @param array $hostnameTokens Hostname tokens
|
||||||
*/
|
*/
|
||||||
public function __construct($staticPrefix, $regex, array $tokens, array $variables)
|
public function __construct($staticPrefix, $regex, array $tokens, array $variables, array $pathVariables = array(), array $hostnameVariables = array(), $hostnameRegex = null, array $hostnameTokens = array())
|
||||||
{
|
{
|
||||||
$this->staticPrefix = $staticPrefix;
|
$this->staticPrefix = $staticPrefix;
|
||||||
$this->regex = $regex;
|
$this->regex = $regex;
|
||||||
$this->tokens = $tokens;
|
$this->tokens = $tokens;
|
||||||
$this->variables = $variables;
|
$this->variables = $variables;
|
||||||
|
$this->pathVariables = $pathVariables;
|
||||||
|
$this->hostnameVariables = $hostnameVariables;
|
||||||
|
$this->hostnameRegex = $hostnameRegex;
|
||||||
|
$this->hostnameTokens = $hostnameTokens;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -59,6 +71,16 @@ class CompiledRoute
|
|||||||
return $this->regex;
|
return $this->regex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the hostname regex
|
||||||
|
*
|
||||||
|
* @return string The hostname regex
|
||||||
|
*/
|
||||||
|
public function getHostnameRegex()
|
||||||
|
{
|
||||||
|
return $this->hostnameRegex;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the tokens.
|
* Returns the tokens.
|
||||||
*
|
*
|
||||||
@ -69,6 +91,16 @@ class CompiledRoute
|
|||||||
return $this->tokens;
|
return $this->tokens;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the hostname tokens.
|
||||||
|
*
|
||||||
|
* @return array The tokens
|
||||||
|
*/
|
||||||
|
public function getHostnameTokens()
|
||||||
|
{
|
||||||
|
return $this->hostnameTokens;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the variables.
|
* Returns the variables.
|
||||||
*
|
*
|
||||||
@ -78,4 +110,25 @@ class CompiledRoute
|
|||||||
{
|
{
|
||||||
return $this->variables;
|
return $this->variables;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the path variables.
|
||||||
|
*
|
||||||
|
* @return array The variables
|
||||||
|
*/
|
||||||
|
public function getPathVariables()
|
||||||
|
{
|
||||||
|
return $this->pathVariables;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the hostname variables.
|
||||||
|
*
|
||||||
|
* @return array The variables
|
||||||
|
*/
|
||||||
|
public function getHostnameVariables()
|
||||||
|
{
|
||||||
|
return $this->hostnameVariables;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user