/** * @param NodeInterface $node * @param RenderingContextInterface $renderingContext * @param boolean $cast * @return mixed */ protected function evaluateChildNode(NodeInterface $node, RenderingContextInterface $renderingContext, $cast) { $output = $node->evaluate($renderingContext); if ($cast && is_object($output)) { if (!method_exists($output, '__toString')) { throw new Parser\Exception('Cannot cast object of type "' . get_class($output) . '" to string.', 1273753083); } $output = (string) $output; } return $output; }