public function __construct($object, $savvy) { if (!$object instanceof Traversable) { throw new Savvy_UnexpectedValueException('$object must be traversable'); } parent::__construct($object, $savvy); if ($object instanceof IteratorAggregate) { $this->innerIterator = $object->getIterator(); } }
/** * Used to render an object through a template. * * @param object $object Model containing data * @param string $template Template to render data through * * @return string Rendered output */ protected function renderObject($object, $template = null) { if ($this->__config['escape']) { if (!$object instanceof Savvy_ObjectProxy) { $object = Savvy_ObjectProxy::factory($object, $this); } if ($object instanceof Traversable && $this->__config['iterate_traversable'] || $object instanceof Savvy_ObjectProxy_ArrayObject) { return $this->renderTraversable($object->getRawObject(), $template); } } elseif ($object instanceof Savvy_ObjectProxy) { $object = $object->getRawObject(); } return $this->fetch($object, $template); }