1 | <?php |
||
26 | class ContactHelper |
||
27 | { |
||
28 | /** |
||
29 | * @var string |
||
30 | */ |
||
31 | private $dirname; |
||
32 | /** |
||
33 | * @var string |
||
34 | */ |
||
35 | private $module; |
||
36 | /** |
||
37 | * @var string |
||
38 | */ |
||
39 | private $handler; |
||
40 | /** |
||
41 | * @var string |
||
42 | */ |
||
43 | private $config; |
||
44 | /** |
||
45 | * @var string |
||
46 | */ |
||
47 | private $debug; |
||
48 | /** |
||
49 | * @var array |
||
50 | */ |
||
51 | private $debugArray = array(); |
||
52 | /* |
||
53 | * @protected function constructor class |
||
54 | * @param mixed $debug |
||
55 | */ |
||
56 | /** |
||
57 | * ContactHelper constructor. |
||
58 | * @param $debug |
||
59 | */ |
||
60 | protected function __construct($debug) |
||
65 | /* |
||
66 | * @static function &getInstance |
||
67 | * @param mixed $debug |
||
68 | */ |
||
69 | /** |
||
70 | * @param bool $debug |
||
71 | * @return bool|ContactHelper |
||
72 | */ |
||
73 | public static function &getInstance($debug = false) |
||
81 | /* |
||
82 | * @static function getModule |
||
83 | * @param null |
||
84 | */ |
||
85 | /** |
||
86 | * @return string |
||
87 | */ |
||
88 | public function &getModule() |
||
95 | /* |
||
96 | * @static function getConfig |
||
97 | * @param string $name |
||
98 | */ |
||
99 | /** |
||
100 | * @param null $name |
||
101 | * @return null|string |
||
102 | */ |
||
103 | public function getConfig($name = null) |
||
119 | /* |
||
120 | * @static function setConfig |
||
121 | * @param string $name |
||
122 | * @param mixed $value |
||
123 | */ |
||
124 | /** |
||
125 | * @param null $name |
||
126 | * @param null $value |
||
127 | * @return mixed |
||
128 | */ |
||
129 | public function setConfig($name = null, $value = null) |
||
138 | /* |
||
139 | * @static function getHandler |
||
140 | * @param string $name |
||
141 | */ |
||
142 | /** |
||
143 | * @param $name |
||
144 | * @return mixed |
||
145 | */ |
||
146 | public function &getHandler($name) |
||
154 | /* |
||
155 | * @static function initModule |
||
156 | * @param null |
||
157 | */ |
||
158 | public function initModule() |
||
170 | /* |
||
171 | * @static function initConfig |
||
172 | * @param null |
||
173 | */ |
||
174 | public function initConfig() |
||
181 | /* |
||
182 | * @static function initHandler |
||
183 | * @param string $name |
||
184 | */ |
||
185 | /** |
||
186 | * @param $name |
||
187 | */ |
||
188 | public function initHandler($name) |
||
193 | /* |
||
194 | * @static function addLog |
||
195 | * @param string $log |
||
196 | */ |
||
197 | /** |
||
198 | * @param $log |
||
199 | */ |
||
200 | public function addLog($log) |
||
208 | } |
||
209 |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.