diff options
author | emkael <emkael@tlen.pl> | 2016-11-03 23:22:40 +0100 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2016-11-03 23:22:40 +0100 |
commit | bef5754e4676a8a578550b6af24d050a946405eb (patch) | |
tree | 190a54af236d00c476b28799ba502a42205a95c5 /app/frontend/url/UrlManager.php | |
parent | 94e03b260197122ae8f6d7dfedfb2a191fdae273 (diff) |
* more strict function definitions
Diffstat (limited to 'app/frontend/url/UrlManager.php')
-rw-r--r-- | app/frontend/url/UrlManager.php | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/app/frontend/url/UrlManager.php b/app/frontend/url/UrlManager.php index a33d98e..1310eaf 100644 --- a/app/frontend/url/UrlManager.php +++ b/app/frontend/url/UrlManager.php @@ -15,7 +15,9 @@ class UrlManager extends TUrlMapping { return rtrim( preg_replace( '#^/' . $serviceParam . '#', - '/' . $this->_convertServiceParam($serviceParam), + '/' . $this->_convertServiceParam( + TPropertyValue::ensureString($serviceParam) + ), preg_replace('#^/' . $serviceID . '#', '', $url) ), '/' @@ -27,7 +29,9 @@ class UrlManager extends TUrlMapping { if ($this->MatchingPattern) { $serviceID = $this->MatchingPattern->ServiceID; if (isset($params[$serviceID])) { - $params[$serviceID] = $this->_parseServiceParam($params[$serviceID]); + $params[$serviceID] = $this->_parseServiceParam( + TPropertyValue::ensureString($params[$serviceID]) + ); } } return $params; @@ -36,7 +40,7 @@ class UrlManager extends TUrlMapping { /** * Convert service param from camelCase to hyphenated-form. **/ - private function _convertServiceParam($param) { + private function _convertServiceParam(string $param = '') { return implode( '-', array_map('mb_strtolower', array_filter(preg_split('/(?=[A-Z])/', $param))) @@ -46,7 +50,7 @@ class UrlManager extends TUrlMapping { /** * Convert service param from hyphenated-form to camelCase. **/ - private function _parseServiceParam($param) { + private function _parseServiceParam(string $param = '') { return implode( '', array_map('ucfirst', explode('-', $param)) |