SmartyBCTrait   A
last analyzed

Complexity

Total Complexity 35

Size/Duplication

Total Lines 451
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 79
dl 0
loc 451
rs 9.6
c 0
b 0
f 0
ccs 0
cts 137
cp 0
wmc 35

35 Methods

Rating   Name   Duplication   Size   Complexity  
A register_resource() 0 4 1
A unregister_function() 0 4 1
A is_cached() 0 4 1
A register_function() 0 4 1
A unregister_object() 0 4 1
A clear_compiled_tpl() 0 4 1
A get_config_vars() 0 4 1
A unregister_modifier() 0 4 1
A register_modifier() 0 4 1
A unregister_block() 0 4 1
A trigger_error() 0 4 1
A register_compiler_function() 0 4 1
A clear_config() 0 4 1
A clear_cache() 0 4 1
A register_postfilter() 0 4 1
A clear_all_assign() 0 4 1
A unregister_resource() 0 4 1
A register_outputfilter() 0 4 1
A unregister_postfilter() 0 4 1
A clear_all_cache() 0 4 1
A get_template_vars() 0 4 1
A get_registered_object() 0 4 1
A load_filter() 0 4 1
A clear_assign() 0 4 1
A append_by_ref() 0 4 1
A unregister_compiler_function() 0 4 1
A unregister_outputfilter() 0 4 1
A template_exists() 0 4 1
A assign_by_ref() 0 4 1
A config_load() 0 4 1
A register_prefilter() 0 4 1
A register_block() 0 4 1
A unregister_prefilter() 0 4 1
A deprecated() 0 9 1
A register_object() 0 6 1
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
The method assignByRef() does not exist on Xoops\Core\SmartyBCTrait. Did you maybe mean assign_by_ref()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

65
        $this->/** @scrutinizer ignore-call */ 
66
               assignByRef($tpl_var, $value);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

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
The method appendByRef() does not exist on Xoops\Core\SmartyBCTrait. Did you maybe mean append_by_ref()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

78
        $this->/** @scrutinizer ignore-call */ 
79
               appendByRef($tpl_var, $value, $merge);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

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
The method clearAssign() does not exist on Xoops\Core\SmartyBCTrait. Did you maybe mean clear_assign()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

89
        $this->/** @scrutinizer ignore-call */ 
90
               clearAssign($tpl_var);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

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? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

103
        $this->/** @scrutinizer ignore-call */ 
104
               registerPlugin('function', $function, $function_impl, $cacheable, $cache_attrs);
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
The method unregisterPlugin() does not exist on Xoops\Core\SmartyBCTrait. Did you maybe mean unregister_block()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

114
        $this->/** @scrutinizer ignore-call */ 
115
               unregisterPlugin('function', $function);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

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
The method registerObject() does not exist on Xoops\Core\SmartyBCTrait. Did you maybe mean register_object()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

134
        $this->/** @scrutinizer ignore-call */ 
135
               registerObject($object, $object_impl, $allowed, $smarty_args, $block_methods);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

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()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

145
        $this->/** @scrutinizer ignore-call */ 
146
               unregisterObject($object);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

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);
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);
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);
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);
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);
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);
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()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

229
        $this->/** @scrutinizer ignore-call */ 
230
               registerResource($type, $functions);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

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()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

240
        $this->/** @scrutinizer ignore-call */ 
241
               unregisterResource($type);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

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
The method registerFilter() does not exist on Xoops\Core\SmartyBCTrait. Did you maybe mean register_postfilter()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

252
        $this->/** @scrutinizer ignore-call */ 
253
               registerFilter('pre', $function);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

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
The method unregisterFilter() does not exist on Xoops\Core\SmartyBCTrait. Did you maybe mean unregister_postfilter()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

263
        $this->/** @scrutinizer ignore-call */ 
264
               unregisterFilter('pre', $function);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

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);
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);
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);
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);
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
The method loadFilter() does not exist on Xoops\Core\SmartyBCTrait. Did you maybe mean load_filter()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

321
        $this->/** @scrutinizer ignore-call */ 
322
               loadFilter($type, $name);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

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
The method clearCache() does not exist on Xoops\Core\SmartyBCTrait. Did you maybe mean clear_cache()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

337
        return $this->/** @scrutinizer ignore-call */ clearCache($tpl_file, $cache_id, $compile_id, $exp_time);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

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);
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? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

365
        return $this->/** @scrutinizer ignore-call */ isCached($tpl_file, $cache_id, $compile_id);
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
The method clearAllAssign() does not exist on Xoops\Core\SmartyBCTrait. Did you maybe mean clear_all_assign()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

374
        $this->/** @scrutinizer ignore-call */ 
375
               clearAllAssign();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

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? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

391
        return $this->/** @scrutinizer ignore-call */ clearCompiledTemplate($tpl_file, $compile_id, $exp_time);
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
The method templateExists() does not exist on Xoops\Core\SmartyBCTrait. Did you maybe mean template_exists()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

404
        return $this->/** @scrutinizer ignore-call */ templateExists($tpl_file);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

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? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

417
        return $this->/** @scrutinizer ignore-call */ getTemplateVars($name);
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? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

430
        return $this->/** @scrutinizer ignore-call */ getConfigVars($name);
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
The method configLoad() does not exist on Xoops\Core\SmartyBCTrait. Did you maybe mean config_load()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

443
        $this->/** @scrutinizer ignore-call */ 
444
               configLoad($file, $section, $scope);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

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? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

456
        return $this->/** @scrutinizer ignore-call */ getRegisteredObject($name);
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
The method clearConfig() does not exist on Xoops\Core\SmartyBCTrait. Did you maybe mean clear_config()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

467
        $this->/** @scrutinizer ignore-call */ 
468
               clearConfig($var);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

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