Completed
Push — master ( 22bc57...1ce92a )
by
unknown
29:24 queued 15:51
created

src/RenderTemplate/PhpRenderTemplate.php (1 issue)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace League\Plates\RenderTemplate;
4
5
use League\Plates;
6
7
final class PhpRenderTemplate implements Plates\RenderTemplate
8
{
9
    private $bind;
10
11 16
    public function __construct(callable $bind = null) {
12 16
        $this->bind = $bind;
13 16
    }
14
15 16
    public function renderTemplate(Plates\Template $template, Plates\RenderTemplate $render = null) {
16 16
        $inc = self::createInclude();
17 16
        $inc = $this->bind ? ($this->bind)($inc, $template) : $inc;
18
19 16
        return Plates\Util\obWrap(function() use ($inc, $template) {
20
            $inc($template->get('path'), $template->data);
21 16
        });
22
    }
23
24
    private static function createInclude() {
25
        return function() {
26
            extract(func_get_arg(1));
0 ignored issues
show
func_get_arg(1) cannot be passed to extract() as the parameter $var_array expects a reference.
Loading history...
27
            include func_get_arg(0);
28
        };
29
    }
30
}
31