Armored getContextPath()

This commit is contained in:
Chris 2016-11-01 15:32:53 +01:00
parent 3cbf504aed
commit bb74b56fc4
1 changed files with 7 additions and 0 deletions

View File

@ -60,10 +60,17 @@ class Shell
public function getContextPath($separator=":") public function getContextPath($separator=":")
{ {
// Return null if we don't have a current context
if (!$this->context)
return null;
// Assemble the contexts to walk
$stack = [ $this->context->getName() ]; $stack = [ $this->context->getName() ];
foreach ($this->contextStack as $context) { foreach ($this->contextStack as $context) {
$stack[] = $context->getName(); $stack[] = $context->getName();
} }
// Reverse the order to make it more logical
$stack = array_reverse($stack); $stack = array_reverse($stack);
return join($separator,$stack); return join($separator,$stack);
} }