Permalink
Browse files

Patched CakeResponse's MapType() to increase performance by reducing …

…hundreds of is_array() and is_string() system calls
  • Loading branch information...
1 parent 5682907 commit 255fe004ebc89d66ddd17b7dc242f006d422aa34 @DiegoMax DiegoMax committed May 1, 2013
Showing with 1 addition and 3 deletions.
  1. +1 −3 lib/Cake/Network/CakeResponse.php
@@ -717,9 +717,7 @@ public function mapType($ctype) {
}
foreach ($this->_mimeTypes as $alias => $types) {
- if (is_array($types) && in_array($ctype, $types)) {
- return $alias;
- } elseif (is_string($types) && $types == $ctype) {
+ if (in_array($ctype, (array)$types)) {
return $alias;
}
}

0 comments on commit 255fe00

Please sign in to comment.