// This is needed because otherwise routes that come afterwards have higher precedence
// than a possible regular expression, which goes against the input order sorting.
$this->items[] = array($prefix, $route);
- $this->matchStart = count($this->items);
+ $this->matchStart = \count($this->items);
return;
}
* @param string $prefix
* @param mixed $route
*
- * @return null|StaticPrefixCollection
+ * @return StaticPrefixCollection|null
*/
private function groupWithItem($item, $prefix, $route)
{
*/
private function detectCommonPrefix($prefix, $anotherPrefix)
{
- $baseLength = strlen($this->prefix);
+ $baseLength = \strlen($this->prefix);
$commonLength = $baseLength;
- $end = min(strlen($prefix), strlen($anotherPrefix));
+ $end = min(\strlen($prefix), \strlen($anotherPrefix));
for ($i = $baseLength; $i <= $end; ++$i) {
if (substr($prefix, 0, $i) !== substr($anotherPrefix, 0, $i)) {
$commonPrefix = rtrim(substr($prefix, 0, $commonLength), '/');
- if (strlen($commonPrefix) > $baseLength) {
+ if (\strlen($commonPrefix) > $baseLength) {
return $commonPrefix;
}
private function shouldBeInlined()
{
- if (count($this->items) >= 3) {
+ if (\count($this->items) >= 3) {
return false;
}
}
foreach ($this->items as $item) {
- if (is_array($item) && $item[0] === $this->prefix) {
+ if (\is_array($item) && $item[0] === $this->prefix) {
return false;
}
}