Skip to content

Commit 9faf5b8

Browse files
committed
Foreach is faster than array_map.
When connecting 500 routes, this method was taking 6ms on my machine. Afterwards it takes 0.
1 parent d5e9ff2 commit 9faf5b8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Routing/Route/Route.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,10 @@ public function extensions($extensions = null)
155155
*/
156156
public function setExtensions(array $extensions)
157157
{
158-
$this->_extensions = array_map('strtolower', $extensions);
158+
$this->_extensions = [];
159+
foreach ($extensions as $ext) {
160+
$this->_extensions[] = strtolower($ext);
161+
}
159162

160163
return $this;
161164
}

0 commit comments

Comments
 (0)