Skip to content
Permalink
Browse files

Engine: $params accepts objects

  • Loading branch information
dg committed Jan 8, 2020
1 parent a0ade88 commit 0b513104c084f5d3300e07d26da7966c6446a87f
Showing with 6 additions and 4 deletions.
  1. +6 −4 src/Latte/Engine.php
@@ -69,20 +69,22 @@ public function __construct()

/**
* Renders template to output.
* @param object|array $params
*/
public function render(string $name, array $params = [], string $block = null): void
public function render(string $name, $params = [], string $block = null): void
{
$this->createTemplate($name, $params + ($block ? ['_renderblock' => $block] : []))
$this->createTemplate($name, (array) $params + ($block ? ['_renderblock' => $block] : []))
->render();
}


/**
* Renders template to string.
* @param object|array $params
*/
public function renderToString(string $name, array $params = [], string $block = null): string
public function renderToString(string $name, $params = [], string $block = null): string
{
$template = $this->createTemplate($name, $params + ($block ? ['_renderblock' => $block] : []));
$template = $this->createTemplate($name, (array) $params + ($block ? ['_renderblock' => $block] : []));
return $template->capture([$template, 'render']);
}

0 comments on commit 0b51310

Please sign in to comment.
You can’t perform that action at this time.