|
25 | 25 | abstract class AbstractFunction implements IFunction |
26 | 26 | { |
27 | 27 | /** |
28 | | - * @var mixed |
| 28 | + * @var mixed PHP module connection ressource/object |
29 | 29 | */ |
30 | 30 | protected $connection; |
31 | 31 |
|
32 | 32 | /** |
33 | | - * @var string |
| 33 | + * @var mixed PHP module remote function ressource/object |
| 34 | + */ |
| 35 | + protected $function; |
| 36 | + |
| 37 | + /** |
| 38 | + * @var string remote function name |
34 | 39 | */ |
35 | 40 | protected $name; |
36 | 41 |
|
37 | 42 | /** |
38 | | - * @var array |
| 43 | + * @var array remote function parameters |
39 | 44 | */ |
40 | 45 | protected $params; |
41 | 46 |
|
42 | 47 | /** |
43 | 48 | * Initialize this class with a connection instance and the function name. |
44 | | - * @param mixed $connection Connection ressource/class |
| 49 | + * @param mixed $connection Connection resource/object |
45 | 50 | * @param string $name |
| 51 | + * @throws \phpsap\exceptions\UnknownFunctionException |
46 | 52 | */ |
47 | 53 | public function __construct($connection, $name) |
48 | 54 | { |
49 | 55 | $this->connection = $connection; |
50 | 56 | $this->name = $name; |
51 | 57 | $this->reset(); |
| 58 | + $this->function = $this->getFunction(); |
52 | 59 | } |
53 | 60 |
|
54 | 61 | /** |
@@ -90,7 +97,8 @@ public function setParam($name, $value) |
90 | 97 | } |
91 | 98 |
|
92 | 99 | /** |
93 | | - * Get a parameter previously defined using setParam() |
| 100 | + * Get a parameter previously defined using setParam(). |
| 101 | + * In case the requested parameter has not been set, return the defined default value. |
94 | 102 | * @param string $name |
95 | 103 | * @param null $default |
96 | 104 | * @return mixed|null |
@@ -141,4 +149,11 @@ abstract public function __destruct(); |
141 | 149 | * @throws \phpsap\exceptions\FunctionCallException |
142 | 150 | */ |
143 | 151 | abstract protected function execute(); |
| 152 | + |
| 153 | + /** |
| 154 | + * Get the PHP module remote function ressource/object. |
| 155 | + * @return mixed |
| 156 | + * @throws \phpsap\exceptions\UnknownFunctionException |
| 157 | + */ |
| 158 | + abstract protected function getFunction(); |
144 | 159 | } |
0 commit comments