mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-03 18:12:40 +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
|
@ -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
Add a link
Reference in a new issue