1 | <?php |
||
17 | class BasicTemplateResolver implements TemplateResolver |
||
18 | { |
||
19 | use TemplateResolverTrait; |
||
20 | |||
21 | /** |
||
22 | * An array of key/value pairs, where _key_ if a pathname and _value_ its weight. |
||
23 | * |
||
24 | * @var array |
||
25 | */ |
||
26 | protected $paths = []; |
||
27 | |||
28 | /** |
||
29 | * @param array $paths |
||
30 | */ |
||
31 | public function __construct(array $paths = []) |
||
38 | |||
39 | /** |
||
40 | * @inheritdoc |
||
41 | */ |
||
42 | public function resolve($name, array $extensions, &$tried = []) |
||
46 | |||
47 | /** |
||
48 | * Adds a path to search templates in. |
||
49 | * |
||
50 | * Note: The path is discarded if it cannot be resolved with `realpath()`. |
||
51 | * |
||
52 | * @param string $path |
||
53 | * @param int $weight |
||
54 | * |
||
55 | * @return string|false The real path, or `false` if the path was not added. |
||
56 | */ |
||
57 | public function add_path($path, $weight = 0) |
||
71 | |||
72 | /** |
||
73 | * Returns the paths used to search templates. |
||
74 | * |
||
75 | * @return array |
||
76 | */ |
||
77 | public function get_paths() |
||
81 | } |
||
82 |