Ejemplo n.º 1
0
 public function testToArrayRecursiveObject()
 {
     $data = new ViewData([]);
     $child = new \stdClass();
     $child->key = 'value';
     $data->child = $child;
     $array = $data->toArray();
     $this->assertArrayHasKey('child', $array);
     $this->assertArrayHasKey('key', $array['child']);
 }
 /**
  * Render this template with the provided data
  *
  * @param  ViewData $data [description]
  * @return [type]       [description]
  */
 public function render($data = null)
 {
     // Ensure that $data is not null
     if (!isset($data)) {
         $data = new ViewData(array());
     }
     // Access the singleton Twig engine
     $engine = Twig::instance();
     // Render the template
     return $engine->render($this->templatePath(), $data->toArray());
 }