Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Routing] Optimised the PHP URL matcher dumper
The cached URL matcher classes contain some unneeded logic. Consider the following example: if (0 === strpos($pathinfo, '/Blog')) { // blog_index if (0 === strpos($pathinfo, '/Blog') && preg_match('#^/Blog/(?P<slug>[^/]+?)$#x', $pathinfo, $matches)) { return array_merge($this->mergeDefaults($matches, array ( '_action' => 'index',)), array('_route' => 'blog_index')); } } The 2nd strpos is not required, as we have already satisfied this condition in the parent if statement. My change will produce the following code for the same routing setup:: if (0 === strpos($pathinfo, '/Blog')) { // blog_index if (preg_match('#^/Blog/(?P<slug>[^/]+?)$#x', $pathinfo, $matches)) { return array_merge($this->mergeDefaults($matches, array ( '_action' => 'index',)), array('_route' => 'blog_index')); } }
- Loading branch information