/** * @param path mixed Array or string path to context node containing * messages, i.e. ['foo', 'bar'] or 'foo.bar' * @param depth int Internal */ public function formatContext(\Fulfil\Context $context, $path = [], $depth = null) { $formatted = []; if (is_string($path)) { $path = explode('.', $path); } if ($depth === null) { $depth = count($path); } $node = !$path ? $context->root() : $context->root()->child($path); if (!$node) { throw new \InvalidArgumentException("Node could not be found at path " . Message::implodePath($path)); } return $this->formatNode($node, $depth); }