]> git.mxchange.org Git - friendica.git/blob - vendor/smarty/smarty/libs/sysplugins/smarty_internal_undefined.php
Merge pull request #4233 from MrPetovan/task/4116-move-smarty-to-composer
[friendica.git] / vendor / smarty / smarty / libs / sysplugins / smarty_internal_undefined.php
1 <?php
2
3 /**
4  * Smarty Internal Undefined
5  *
6  * Class to handle undefined method calls or calls to obsolete runtime extensions
7  *
8  * @package    Smarty
9  * @subpackage PluginsInternal
10  * @author     Uwe Tews
11  */
12 class Smarty_Internal_Undefined
13 {
14
15     /**
16      * Name of undefined extension class
17      *
18      * @var string|null
19      */
20     public $class = null;
21
22     /**
23      * Smarty_Internal_Undefined constructor.
24      *
25      * @param null|string $class name of undefined extension class
26      */
27     public function __construct($class = null)
28     {
29         $this->class = $class;
30     }
31
32     /**
33      * Wrapper for obsolete class Smarty_Internal_Runtime_ValidateCompiled
34      *
35      * @param  \Smarty_Internal_Template $tpl
36      * @param  array                     $properties special template properties
37      * @param  bool                      $cache      flag if called from cache file
38      *
39      * @return bool false
40      */
41     public function decodeProperties(Smarty_Internal_Template $tpl, $properties, $cache = false)
42     {
43         if ($cache) {
44             $tpl->cached->valid = false;
45         } else {
46             $tpl->mustCompile = true;
47         }
48         return false;
49     }
50
51     /**
52      * Call error handler for undefined method
53      *
54      * @param string $name unknown method-name
55      * @param array  $args argument array
56      *
57      * @return mixed
58      * @throws SmartyException
59      */
60     public function __call($name, $args)
61     {
62         if (isset($this->class)) {
63             throw new SmartyException("undefined extension class '{$this->class}'");
64         } else {
65             throw new SmartyException(get_class($args[ 0 ]) . "->{$name}() undefined method");
66         }
67     }
68 }