text changes to registration mail content
[namibia] / module / Utility / src / Utility / Import / Callback.php
1 <?php
2 namespace Utility\Import;
3
4 class CallBack implements FieldInterface
5 {
6         private $_function;
7         private $_parameters = null;
8         public $placeHolder = null;
9
10         public function __construct($function, array $parameters = null)
11         {
12                 $this->_function = $function;
13                 if($parameters)
14                         $this->_parameters = $parameters;
15         }
16
17         public function parse($value)
18         {
19                 $parameters = array();
20                 if($this->_parameters) {
21                         $parameters = $this->_parameters;
22                 }
23                 if($this->placeHolder) {
24                         $key = array_search($this->placeHolder, $this->_parameters);
25                         if($key)
26                                 $parameters[$key] = $value;
27                 } else
28                         array_unshift($parameters, $value);
29
30                 return call_user_func_array($this->_function, $parameters);
31         }
32 }