Use isset() for performance. Same difference.

This commit is contained in:
Michael Mulligan
2015-11-04 15:14:36 -05:00
parent 5d978bb6e5
commit 425daed8d0
+2 -1
View File
@@ -136,7 +136,8 @@ class CaseInsensitiveArray implements \ArrayAccess, \Countable, \Iterator {
*/
public function offsetGet($offset) {
$offsetlower = strtolower($offset);
return array_key_exists($offsetlower, $this->data) ? $this->data[$offsetlower] : NULL;
// As isset() is false on 'NULL' anyway, use it, and return NULL, faster
return isset($this->data[$offsetlower]) ? $this->data[$offsetlower] : NULL;
}
/**