Subversion Repository Public Repository

Nextrek

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php

/**
 * @deprecated
 */
class PHPParser_TemplateLoader
{
    protected $parser;
    protected $baseDir;
    protected $suffix;

    /**
     * Constructs a filesystem template loader.
     *
     * The templates are loaded from {baseDir}/{name}{suffix}.
     *
     * @param PHPParser_Parser $parser  A PHP parser instance
     * @param string           $baseDir The base directory to load templates from
     * @param string           $suffix  An optional suffix to append after the template name
     */
    public function __construct(PHPParser_Parser $parser, $baseDir, $suffix = '') {
        if (!is_dir($baseDir)) {
            throw new InvalidArgumentException(
                sprintf('The specified base directory "%s" does not exist', $baseDir)
            );
        }

        $this->parser  = $parser;
        $this->baseDir = $baseDir;
        $this->suffix  = $suffix;
    }

    /**
     * Loads the template with the specified name.
     *
     * @param string $name The name of template
     *
     * @return PHPParser_Template The loaded template
     */
    public function load($name) {
        $file = $this->baseDir . '/' . $name . $this->suffix;

        if (!is_file($file)) {
            throw new InvalidArgumentException(
                sprintf('The file "%s" does not exist', $file)
            );
        }

        return new PHPParser_Template($this->parser, file_get_contents($file));
    }
}

Commits for Nextrek/Aiba_backup/vendor/nikic/php-parser/lib/PHPParser/TemplateLoader.php

Diff revisions: vs.
Revision Author Commited Message
1464 MOliva picture MOliva Tue 13 Oct, 2020 11:16:56 +0000