Completed
Pull Request — master (#499)
by Richard
10:41
created

SmartyBCTrait::append_by_ref()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 1
eloc 3
c 1
b 1
f 0
nc 1
nop 3
dl 0
loc 5
ccs 0
cts 4
cp 0
crap 2
rs 9.4285
1
<?php
2
namespace Xoops\Core;
3
4
/**
5
 * Project:     Smarty: the PHP compiling template engine
6
 * File:        SmartyBC.class.php
7
 * SVN:         $Id: $
8
 * This library is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU Lesser General Public
10
 * License as published by the Free Software Foundation; either
11
 * version 2.1 of the License, or (at your option) any later version.
12
 * This library is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
 * Lesser General Public License for more details.
16
 * You should have received a copy of the GNU Lesser General Public
17
 * License along with this library; if not, write to the Free Software
18
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
 * For questions, help, comments, discussion, etc., please join the
20
 * Smarty mailing list. Send a blank e-mail to
21
 * [email protected]
22
 *
23
 * @link      http://www.smarty.net/
24
 * @copyright 2008 New Digital Group, Inc.
25
 * @author    Monte Ohrt <monte at ohrt dot com>
26
 * @author    Uwe Tews
27
 * @author    Rodney Rehm
28
 * @package   Smarty
29
 */
30
31
32
/**
33
 * Smarty Backward Compatibility Wrapper Class as a trait, adapted from SmartyBC.class.php
34
 *
35
 * Older XOOPS modules make direct calls to Smarty, and the renamed classes in Smarty V3 cause issues.
36
 *
37
 * By adding this trait, we make an easy to remove BC layer, to which we can add diagnostics
38
 * to make the process of modernizing a little smoother.
39
 */
40
trait SmartyBCTrait
41
{
42
    /**
43
     * Smarty 2 BC
44
     *
45
     * @var string
46
     */
47
    public $_version = self::SMARTY_VERSION;
48
49
    /**
50
     * This is an array of directories where trusted php scripts reside.
51
     *
52
     * @var array
53
     */
54
    public $trusted_dir = array();
55
56
    /**
57
     * wrapper for assign_by_ref
58
     *
59
     * @param string $tpl_var the template variable name
60
     * @param mixed  &$value  the referenced value to assign
61
     */
62
    public function assign_by_ref($tpl_var, &$value)
63
    {
64
        $this->deprecated(__METHOD__, __FILE__, (__LINE__ + 1));
65
        $this->assignByRef($tpl_var, $value);
0 ignored issues
show
Bug introduced by
It seems like assignByRef() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
66
    }
67
68
    /**
69
     * wrapper for append_by_ref
70
     *
71
     * @param string  $tpl_var the template variable name
72
     * @param mixed   &$value  the referenced value to append
73
     * @param boolean $merge   flag if array elements shall be merged
74
     */
75
    public function append_by_ref($tpl_var, &$value, $merge = false)
76
    {
77
        $this->deprecated(__METHOD__, __FILE__, (__LINE__ + 1));
78
        $this->appendByRef($tpl_var, $value, $merge);
0 ignored issues
show
Bug introduced by
It seems like appendByRef() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
79
    }
80
81
    /**
82
     * clear the given assigned template variable.
83
     *
84
     * @param string $tpl_var the template variable to clear
85
     */
86
    public function clear_assign($tpl_var)
87
    {
88
        $this->deprecated(__METHOD__, __FILE__, (__LINE__ + 1));
89
        $this->clearAssign($tpl_var);
0 ignored issues
show
Bug introduced by
It seems like clearAssign() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
90
    }
91
92
    /**
93
     * Registers custom function to be used in templates
94
     *
95
     * @param string $function      the name of the template function
96
     * @param string $function_impl the name of the PHP function to register
97
     * @param bool   $cacheable
98
     * @param mixed  $cache_attrs
99
     */
100
    public function register_function($function, $function_impl, $cacheable = true, $cache_attrs = null)
101
    {
102
        $this->deprecated(__METHOD__, __FILE__, (__LINE__ + 1));
103
        $this->registerPlugin('function', $function, $function_impl, $cacheable, $cache_attrs);
0 ignored issues
show
Bug introduced by
It seems like registerPlugin() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
104
    }
105
106
    /**
107
     * Unregisters custom function
108
     *
109
     * @param string $function name of template function
110
     */
111
    public function unregister_function($function)
112
    {
113
        $this->deprecated(__METHOD__, __FILE__, (__LINE__ + 1));
114
        $this->unregisterPlugin('function', $function);
0 ignored issues
show
Bug introduced by
It seems like unregisterPlugin() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
115
    }
116
117
    /**
118
     * Registers object to be used in templates
119
     *
120
     * @param string  $object        name of template object
121
     * @param object  $object_impl   the referenced PHP object to register
122
     * @param array   $allowed       list of allowed methods (empty = all)
123
     * @param boolean $smarty_args   smarty argument format, else traditional
124
     * @param array   $block_methods list of methods that are block format
125
     *
126
     * @throws \SmartyException
127
     * @internal param array $block_functs list of methods that are block format
128
     */
129
    public function register_object($object, $object_impl, $allowed = array(), $smarty_args = true, $block_methods = array())
130
    {
131
        $this->deprecated(__METHOD__, __FILE__, (__LINE__ + 1));
132
        settype($allowed, 'array');
133
        settype($smarty_args, 'boolean');
134
        $this->registerObject($object, $object_impl, $allowed, $smarty_args, $block_methods);
0 ignored issues
show
Bug introduced by
It seems like registerObject() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
135
    }
136
137
    /**
138
     * Unregisters object
139
     *
140
     * @param string $object name of template object
141
     */
142
    public function unregister_object($object)
143
    {
144
        $this->deprecated(__METHOD__, __FILE__, (__LINE__ + 1));
145
        $this->unregisterObject($object);
0 ignored issues
show
Bug introduced by
The method unregisterObject() does not exist on Xoops\Core\SmartyBCTrait. Did you maybe mean unregister_object()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
146
    }
147
148
    /**
149
     * Registers block function to be used in templates
150
     *
151
     * @param string $block      name of template block
152
     * @param string $block_impl PHP function to register
153
     * @param bool   $cacheable
154
     * @param mixed  $cache_attrs
155
     */
156
    public function register_block($block, $block_impl, $cacheable = true, $cache_attrs = null)
157
    {
158
        $this->deprecated(__METHOD__, __FILE__, (__LINE__ + 1));
159
        $this->registerPlugin('block', $block, $block_impl, $cacheable, $cache_attrs);
0 ignored issues
show
Bug introduced by
It seems like registerPlugin() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
160
    }
161
162
    /**
163
     * Unregisters block function
164
     *
165
     * @param string $block name of template function
166
     */
167
    public function unregister_block($block)
168
    {
169
        $this->deprecated(__METHOD__, __FILE__, (__LINE__ + 1));
170
        $this->unregisterPlugin('block', $block);
0 ignored issues
show
Bug introduced by
It seems like unregisterPlugin() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
171
    }
172
173
    /**
174
     * Registers compiler function
175
     *
176
     * @param string $function      name of template function
177
     * @param string $function_impl name of PHP function to register
178
     * @param bool   $cacheable
179
     */
180
    public function register_compiler_function($function, $function_impl, $cacheable = true)
181
    {
182
        $this->deprecated(__METHOD__, __FILE__, (__LINE__ + 1));
183
        $this->registerPlugin('compiler', $function, $function_impl, $cacheable);
0 ignored issues
show
Bug introduced by
It seems like registerPlugin() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
184
    }
185
186
    /**
187
     * Unregisters compiler function
188
     *
189
     * @param string $function name of template function
190
     */
191
    public function unregister_compiler_function($function)
192
    {
193
        $this->deprecated(__METHOD__, __FILE__, (__LINE__ + 1));
194
        $this->unregisterPlugin('compiler', $function);
0 ignored issues
show
Bug introduced by
It seems like unregisterPlugin() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
195
    }
196
197
    /**
198
     * Registers modifier to be used in templates
199
     *
200
     * @param string $modifier      name of template modifier
201
     * @param string $modifier_impl name of PHP function to register
202
     */
203
    public function register_modifier($modifier, $modifier_impl)
204
    {
205
        $this->deprecated(__METHOD__, __FILE__, (__LINE__ + 1));
206
        $this->registerPlugin('modifier', $modifier, $modifier_impl);
0 ignored issues
show
Bug introduced by
It seems like registerPlugin() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
207
    }
208
209
    /**
210
     * Unregisters modifier
211
     *
212
     * @param string $modifier name of template modifier
213
     */
214
    public function unregister_modifier($modifier)
215
    {
216
        $this->deprecated(__METHOD__, __FILE__, (__LINE__ + 1));
217
        $this->unregisterPlugin('modifier', $modifier);
0 ignored issues
show
Bug introduced by
It seems like unregisterPlugin() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
218
    }
219
220
    /**
221
     * Registers a resource to fetch a template
222
     *
223
     * @param string $type      name of resource
224
     * @param array  $functions array of functions to handle resource
225
     */
226
    public function register_resource($type, $functions)
227
    {
228
        $this->deprecated(__METHOD__, __FILE__, (__LINE__ + 1));
229
        $this->registerResource($type, $functions);
0 ignored issues
show
Bug introduced by
The method registerResource() does not exist on Xoops\Core\SmartyBCTrait. Did you maybe mean register_resource()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
230
    }
231
232
    /**
233
     * Unregisters a resource
234
     *
235
     * @param string $type name of resource
236
     */
237
    public function unregister_resource($type)
238
    {
239
        $this->deprecated(__METHOD__, __FILE__, (__LINE__ + 1));
240
        $this->unregisterResource($type);
0 ignored issues
show
Bug introduced by
The method unregisterResource() does not exist on Xoops\Core\SmartyBCTrait. Did you maybe mean unregister_resource()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
241
    }
242
243
    /**
244
     * Registers a prefilter function to apply
245
     * to a template before compiling
246
     *
247
     * @param callable $function
248
     */
249
    public function register_prefilter($function)
250
    {
251
        $this->deprecated(__METHOD__, __FILE__, (__LINE__ + 1));
252
        $this->registerFilter('pre', $function);
0 ignored issues
show
Bug introduced by
It seems like registerFilter() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
253
    }
254
255
    /**
256
     * Unregisters a prefilter function
257
     *
258
     * @param callable $function
259
     */
260
    public function unregister_prefilter($function)
261
    {
262
        $this->deprecated(__METHOD__, __FILE__, (__LINE__ + 1));
263
        $this->unregisterFilter('pre', $function);
0 ignored issues
show
Bug introduced by
It seems like unregisterFilter() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
264
    }
265
266
    /**
267
     * Registers a postfilter function to apply
268
     * to a compiled template after compilation
269
     *
270
     * @param callable $function
271
     */
272
    public function register_postfilter($function)
273
    {
274
        $this->deprecated(__METHOD__, __FILE__, (__LINE__ + 1));
275
        $this->registerFilter('post', $function);
0 ignored issues
show
Bug introduced by
It seems like registerFilter() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
276
    }
277
278
    /**
279
     * Unregisters a postfilter function
280
     *
281
     * @param callable $function
282
     */
283
    public function unregister_postfilter($function)
284
    {
285
        $this->deprecated(__METHOD__, __FILE__, (__LINE__ + 1));
286
        $this->unregisterFilter('post', $function);
0 ignored issues
show
Bug introduced by
It seems like unregisterFilter() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
287
    }
288
289
    /**
290
     * Registers an output filter function to apply
291
     * to a template output
292
     *
293
     * @param callable $function
294
     */
295
    public function register_outputfilter($function)
296
    {
297
        $this->deprecated(__METHOD__, __FILE__, (__LINE__ + 1));
298
        $this->registerFilter('output', $function);
0 ignored issues
show
Bug introduced by
It seems like registerFilter() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
299
    }
300
301
    /**
302
     * Unregisters an outputfilter function
303
     *
304
     * @param callable $function
305
     */
306
    public function unregister_outputfilter($function)
307
    {
308
        $this->deprecated(__METHOD__, __FILE__, (__LINE__ + 1));
309
        $this->unregisterFilter('output', $function);
0 ignored issues
show
Bug introduced by
It seems like unregisterFilter() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
310
    }
311
312
    /**
313
     * load a filter of specified type and name
314
     *
315
     * @param string $type filter type
316
     * @param string $name filter name
317
     */
318
    public function load_filter($type, $name)
319
    {
320
        $this->deprecated(__METHOD__, __FILE__, (__LINE__ + 1));
321
        $this->loadFilter($type, $name);
0 ignored issues
show
Bug introduced by
It seems like loadFilter() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
322
    }
323
324
    /**
325
     * clear cached content for the given template and cache id
326
     *
327
     * @param  string $tpl_file   name of template file
328
     * @param  string $cache_id   name of cache_id
329
     * @param  string $compile_id name of compile_id
330
     * @param  string $exp_time   expiration time
331
     *
332
     * @return boolean
333
     */
334
    public function clear_cache($tpl_file = null, $cache_id = null, $compile_id = null, $exp_time = null)
335
    {
336
        $this->deprecated(__METHOD__, __FILE__, (__LINE__ + 1));
337
        return $this->clearCache($tpl_file, $cache_id, $compile_id, $exp_time);
0 ignored issues
show
Bug introduced by
It seems like clearCache() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
338
    }
339
340
    /**
341
     * clear the entire contents of cache (all templates)
342
     *
343
     * @param  string $exp_time expire time
344
     *
345
     * @return boolean
346
     */
347
    public function clear_all_cache($exp_time = null)
348
    {
349
        $this->deprecated(__METHOD__, __FILE__, (__LINE__ + 1));
350
        return $this->clearCache(null, null, null, $exp_time);
0 ignored issues
show
Bug introduced by
It seems like clearCache() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
351
    }
352
353
    /**
354
     * test to see if valid cache exists for this template
355
     *
356
     * @param  string $tpl_file name of template file
357
     * @param  string $cache_id
358
     * @param  string $compile_id
359
     *
360
     * @return boolean
361
     */
362
    public function is_cached($tpl_file, $cache_id = null, $compile_id = null)
363
    {
364
        $this->deprecated(__METHOD__, __FILE__, (__LINE__ + 1));
365
        return $this->isCached($tpl_file, $cache_id, $compile_id);
0 ignored issues
show
Bug introduced by
It seems like isCached() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
366
    }
367
368
    /**
369
     * clear all the assigned template variables.
370
     */
371
    public function clear_all_assign()
372
    {
373
        $this->deprecated(__METHOD__, __FILE__, (__LINE__ + 1));
374
        $this->clearAllAssign();
0 ignored issues
show
Bug introduced by
It seems like clearAllAssign() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
375
    }
376
377
    /**
378
     * clears compiled version of specified template resource,
379
     * or all compiled template files if one is not specified.
380
     * This function is for advanced use only, not normally needed.
381
     *
382
     * @param  string $tpl_file
383
     * @param  string $compile_id
384
     * @param  string $exp_time
385
     *
386
     * @return boolean results of {@link smarty_core_rm_auto()}
387
     */
388
    public function clear_compiled_tpl($tpl_file = null, $compile_id = null, $exp_time = null)
389
    {
390
        $this->deprecated(__METHOD__, __FILE__, (__LINE__ + 1));
391
        return $this->clearCompiledTemplate($tpl_file, $compile_id, $exp_time);
0 ignored issues
show
Bug introduced by
It seems like clearCompiledTemplate() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
392
    }
393
394
    /**
395
     * Checks whether requested template exists.
396
     *
397
     * @param  string $tpl_file
398
     *
399
     * @return boolean
400
     */
401
    public function template_exists($tpl_file)
402
    {
403
        $this->deprecated(__METHOD__, __FILE__, (__LINE__ + 1));
404
        return $this->templateExists($tpl_file);
0 ignored issues
show
Bug introduced by
It seems like templateExists() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
405
    }
406
407
    /**
408
     * Returns an array containing template variables
409
     *
410
     * @param  string $name
411
     *
412
     * @return array
413
     */
414
    public function get_template_vars($name = null)
415
    {
416
        $this->deprecated(__METHOD__, __FILE__, (__LINE__ + 1));
417
        return $this->getTemplateVars($name);
0 ignored issues
show
Bug introduced by
It seems like getTemplateVars() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
418
    }
419
420
    /**
421
     * Returns an array containing config variables
422
     *
423
     * @param  string $name
424
     *
425
     * @return array
426
     */
427
    public function get_config_vars($name = null)
428
    {
429
        $this->deprecated(__METHOD__, __FILE__, (__LINE__ + 1));
430
        return $this->getConfigVars($name);
0 ignored issues
show
Bug introduced by
It seems like getConfigVars() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
431
    }
432
433
    /**
434
     * load configuration values
435
     *
436
     * @param string $file
437
     * @param string $section
438
     * @param string $scope
439
     */
440
    public function config_load($file, $section = null, $scope = 'global')
441
    {
442
        $this->deprecated(__METHOD__, __FILE__, (__LINE__ + 1));
443
        $this->configLoad($file, $section, $scope);
0 ignored issues
show
Bug introduced by
It seems like configLoad() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
444
    }
445
446
    /**
447
     * return a reference to a registered object
448
     *
449
     * @param  string $name
450
     *
451
     * @return object
452
     */
453
    public function get_registered_object($name)
454
    {
455
        $this->deprecated(__METHOD__, __FILE__, (__LINE__ + 1));
456
        return $this->getRegisteredObject($name);
0 ignored issues
show
Bug introduced by
It seems like getRegisteredObject() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
457
    }
458
459
    /**
460
     * clear configuration values
461
     *
462
     * @param string $var
463
     */
464
    public function clear_config($var = null)
465
    {
466
        $this->deprecated(__METHOD__, __FILE__, (__LINE__ + 1));
467
        $this->clearConfig($var);
0 ignored issues
show
Bug introduced by
It seems like clearConfig() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
468
    }
469
470
    /**
471
     * trigger Smarty error
472
     *
473
     * @param string  $error_msg
474
     * @param integer $error_type
475
     */
476
    public function trigger_error($error_msg, $error_type = E_USER_WARNING)
477
    {
478
        $this->deprecated(__METHOD__, __FILE__, (__LINE__ + 1));
479
        trigger_error("Smarty error: $error_msg", $error_type);
480
    }
481
482
    protected function deprecated($function, $file, $line)
483
    {
484
        $xoops = \Xoops::getInstance();
485
        $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2);
486
        $xoops->deprecated(
487
            "{$function} is deprecated. Called from {$trace[1]['file']} line {$trace[1]['line']}."
488
            . " See how to replace it in file {$file} line {$line}"
489
        );
490
        return $xoops;
491
    }
492
}
493