Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
92.31% covered (success)
92.31%
24 / 26
92.86% covered (success)
92.86%
13 / 14
CRAP
0.00% covered (danger)
0.00%
0 / 1
base
92.31% covered (success)
92.31%
24 / 26
92.86% covered (success)
92.86%
13 / 14
17.13
0.00% covered (danger)
0.00%
0 / 1
 set_filenames
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 get_filename_from_handle
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
2
 destroy
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 destroy_block_vars
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 assign_vars
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
2
 assign_var
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 append_var
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 retrieve_vars
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
2
 retrieve_var
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 assign_block_vars
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 assign_block_vars_array
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 retrieve_block_vars
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 alter_block_array
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 find_key_index
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2/**
3*
4* This file is part of the phpBB Forum Software package.
5*
6* @copyright (c) phpBB Limited <https://www.phpbb.com>
7* @license GNU General Public License, version 2 (GPL-2.0)
8*
9* For full copyright and license information, please see
10* the docs/CREDITS.txt file.
11*
12*/
13
14namespace phpbb\template;
15
16abstract class base implements template
17{
18    /**
19    * Template context.
20    * Stores template data used during template rendering.
21    *
22    * @var \phpbb\template\context
23    */
24    protected $context;
25
26    /**
27    * Array of filenames assigned to set_filenames
28    *
29    * @var array
30    */
31    protected $filenames = array();
32
33    /**
34    * {@inheritdoc}
35    */
36    public function set_filenames(array $filename_array)
37    {
38        $this->filenames = array_merge($this->filenames, $filename_array);
39
40        return $this;
41    }
42
43    /**
44    * Get a filename from the handle
45    *
46    * @param string $handle
47    * @return string
48    */
49    protected function get_filename_from_handle($handle)
50    {
51        return (isset($this->filenames[$handle])) ? $this->filenames[$handle] : $handle;
52    }
53
54    /**
55    * {@inheritdoc}
56    */
57    public function destroy()
58    {
59        $this->context->clear();
60
61        return $this;
62    }
63
64    /**
65    * {@inheritdoc}
66    */
67    public function destroy_block_vars($blockname)
68    {
69        $this->context->destroy_block_vars($blockname);
70
71        return $this;
72    }
73
74    /**
75    * {@inheritdoc}
76    */
77    public function assign_vars(array $vararray)
78    {
79        foreach ($vararray as $key => $val)
80        {
81            $this->assign_var($key, $val);
82        }
83
84        return $this;
85    }
86
87    /**
88    * {@inheritdoc}
89    */
90    public function assign_var(string $varname, mixed $varval)
91    {
92        $this->context->assign_var($varname, $varval);
93
94        return $this;
95    }
96
97    /**
98    * {@inheritdoc}
99    */
100    public function append_var($varname, $varval)
101    {
102        $this->context->append_var($varname, $varval);
103
104        return $this;
105    }
106
107    /**
108    * {@inheritdoc}
109    */
110    public function retrieve_vars(array $vararray)
111    {
112        $result = array();
113        foreach ($vararray as $varname)
114        {
115            $result[$varname] = $this->retrieve_var($varname);
116        }
117        return $result;
118    }
119
120    /**
121    * {@inheritdoc}
122    */
123    public function retrieve_var($varname)
124    {
125        return $this->context->retrieve_var($varname);
126    }
127
128    /**
129    * {@inheritdoc}
130    */
131    public function assign_block_vars($blockname, array $vararray)
132    {
133        $this->context->assign_block_vars($blockname, $vararray);
134
135        return $this;
136    }
137
138    /**
139    * {@inheritdoc}
140    */
141    public function assign_block_vars_array($blockname, array $block_vars_array)
142    {
143        $this->context->assign_block_vars_array($blockname, $block_vars_array);
144
145        return $this;
146    }
147
148    /**
149    * {@inheritdoc}
150    */
151    public function retrieve_block_vars($blockname, array $vararray)
152    {
153        return $this->context->retrieve_block_vars($blockname, $vararray);
154    }
155
156    /**
157    * {@inheritdoc}
158    */
159    public function alter_block_array($blockname, array $vararray, $key = false, $mode = 'insert')
160    {
161        return $this->context->alter_block_array($blockname, $vararray, $key, $mode);
162    }
163
164    /**
165    * {@inheritdoc}
166    */
167    public function find_key_index($blockname, $key)
168    {
169        return $this->context->find_key_index($blockname, $key);
170    }
171}