mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-23 22:45:20 +00:00
Merge "Rename "key" variable to "lookup""
This commit is contained in:
commit
97e144755d
|
@ -298,23 +298,23 @@ class ReferenceStack {
|
|||
return;
|
||||
}
|
||||
|
||||
$key = $name;
|
||||
$lookup = $name;
|
||||
if ( $name === null ) {
|
||||
// Find anonymous ref by key.
|
||||
foreach ( $this->refs[$group] as $k => $v ) {
|
||||
if ( isset( $this->refs[$group][$k]['key'] ) &&
|
||||
$this->refs[$group][$k]['key'] === $index
|
||||
) {
|
||||
$key = $k;
|
||||
$lookup = $k;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Sanity checks that specified element exists.
|
||||
if ( $key === null ||
|
||||
!isset( $this->refs[$group][$key] ) ||
|
||||
$this->refs[$group][$key]['key'] !== $index
|
||||
if ( $lookup === null ||
|
||||
!isset( $this->refs[$group][$lookup] ) ||
|
||||
$this->refs[$group][$lookup]['key'] !== $index
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
@ -326,7 +326,7 @@ class ReferenceStack {
|
|||
switch ( $action ) {
|
||||
case 'new':
|
||||
# Rollback the addition of new elements to the stack.
|
||||
unset( $this->refs[$group][$key] );
|
||||
unset( $this->refs[$group][$lookup] );
|
||||
if ( $this->refs[$group] === [] ) {
|
||||
// TODO: Unsetting is unecessary.
|
||||
$this->deleteGroup( $group );
|
||||
|
@ -335,12 +335,12 @@ class ReferenceStack {
|
|||
break;
|
||||
case 'assign':
|
||||
# Rollback assignment of text to pre-existing elements.
|
||||
$this->refs[$group][$key]['text'] = null;
|
||||
$this->refs[$group][$key]['count']--;
|
||||
$this->refs[$group][$lookup]['text'] = null;
|
||||
$this->refs[$group][$lookup]['count']--;
|
||||
break;
|
||||
case 'increment':
|
||||
# Rollback increase in named ref occurrences.
|
||||
$this->refs[$group][$key]['count']--;
|
||||
$this->refs[$group][$lookup]['count']--;
|
||||
break;
|
||||
default:
|
||||
throw new \LogicException( "Unknown call stack action \"$action\"" );
|
||||
|
|
Loading…
Reference in a new issue