mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Optimizing in_array() checks to isset().
No more in_array($a, array_keys($b)) patterns exist. Closes #5161 git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7624 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
8ae5866a1c
commit
0f9a4e0470
2 changed files with 5 additions and 5 deletions
|
@ -439,7 +439,7 @@ class RequestHandlerComponent extends Object {
|
|||
return false;
|
||||
} elseif (is_string($type)) {
|
||||
|
||||
if (!in_array($type, array_keys($this->__requestContent))) {
|
||||
if (!isset($this->__requestContent[$type])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -560,7 +560,7 @@ class RequestHandlerComponent extends Object {
|
|||
$this->__renderType = $type;
|
||||
$controller->layoutPath = $type;
|
||||
|
||||
if (in_array($type, array_keys($this->__requestContent))) {
|
||||
if (isset($this->__requestContent[$type])) {
|
||||
$this->respondAs($type, $options);
|
||||
}
|
||||
|
||||
|
|
|
@ -1086,13 +1086,13 @@ class Xml extends XmlNode {
|
|||
*/
|
||||
function resolveNamespace($name, $url) {
|
||||
$_this =& XmlManager::getInstance();
|
||||
if ($url == null && in_array($name, array_keys($_this->defaultNamespaceMap))) {
|
||||
if ($url == null && isset($_this->defaultNamespaceMap[$name])) {
|
||||
$url = $_this->defaultNamespaceMap[$name];
|
||||
} elseif ($url == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!strpos($url, '://') && in_array($name, array_keys($_this->defaultNamespaceMap))) {
|
||||
if (!strpos($url, '://') && isset($_this->defaultNamespaceMap[$name])) {
|
||||
$_url = $_this->defaultNamespaceMap[$name];
|
||||
$name = $url;
|
||||
$url = $_url;
|
||||
|
@ -1117,7 +1117,7 @@ class Xml extends XmlNode {
|
|||
*/
|
||||
function removeGlobalNs($name) {
|
||||
$_this =& XmlManager::getInstance();
|
||||
if (in_array($name, array_keys($_this->namespaces))) {
|
||||
if (isset($_this->namespaces[$name])) {
|
||||
unset($_this->namespaces[$name]);
|
||||
unset($this->namespaces[$name]);
|
||||
return true;
|
||||
|
|
Loading…
Add table
Reference in a new issue