mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Optimization for Hash method
This commit is contained in:
parent
3e28326d9c
commit
ecdf0e6c6c
1 changed files with 4 additions and 10 deletions
|
@ -47,7 +47,7 @@ class Hash {
|
|||
} else {
|
||||
$parts = $path;
|
||||
}
|
||||
while (($key = array_shift($parts)) !== null) {
|
||||
foreach ($parts as $key) {
|
||||
if (is_array($data) && isset($data[$key])) {
|
||||
$data =& $data[$key];
|
||||
} else {
|
||||
|
@ -106,8 +106,7 @@ class Hash {
|
|||
|
||||
$context = array($_key => array($data));
|
||||
|
||||
do {
|
||||
$token = array_shift($tokens);
|
||||
foreach ($tokens as $token) {
|
||||
$next = array();
|
||||
|
||||
$conditions = false;
|
||||
|
@ -137,7 +136,7 @@ class Hash {
|
|||
}
|
||||
$context = array($_key => $next);
|
||||
|
||||
} while (!empty($tokens));
|
||||
}
|
||||
return $context[$_key];
|
||||
}
|
||||
|
||||
|
@ -176,12 +175,7 @@ class Hash {
|
|||
PREG_SET_ORDER
|
||||
);
|
||||
|
||||
$ok = true;
|
||||
while ($ok) {
|
||||
if (empty($conditions)) {
|
||||
break;
|
||||
}
|
||||
$cond = array_shift($conditions);
|
||||
foreach ($conditions as $cond) {
|
||||
$attr = $cond['attr'];
|
||||
$op = isset($cond['op']) ? $cond['op'] : null;
|
||||
$val = isset($cond['val']) ? $cond['val'] : null;
|
||||
|
|
Loading…
Reference in a new issue