Skip to content

Commit

Permalink
Merge tag 'v11.31.0'
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
crynobone committed Nov 14, 2024
2 parents 7979007 + 0f0b219 commit 57c0435
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions Context/Repository.php
Original file line number Diff line number Diff line change
@@ -289,6 +289,23 @@ public function push($key, ...$values)
return $this;
}

/**
* Pop the latest value from the key's stack.
*
* @param string $key
* @return mixed
*
* @throws \RuntimeException
*/
public function pop($key)
{
if (! $this->isStackable($key) || ! count($this->data[$key])) {
throw new RuntimeException("Unable to pop value from context stack for key [{$key}].");
}

return array_pop($this->data[$key]);
}

/**
* Push the given hidden values onto the key's stack.
*
@@ -312,6 +329,23 @@ public function pushHidden($key, ...$values)
return $this;
}

/**
* Pop the latest hidden value from the key's stack.
*
* @param string $key
* @return mixed
*
* @throws \RuntimeException
*/
public function popHidden($key)
{
if (! $this->isHiddenStackable($key) || ! count($this->hidden[$key])) {
throw new RuntimeException("Unable to pop value from hidden context stack for key [{$key}].");
}

return array_pop($this->hidden[$key]);
}

/**
* Determine if the given value is in the given stack.
*

0 comments on commit 57c0435

Please sign in to comment.