12 |
* $Id$ |
* $Id$ |
13 |
* |
* |
14 |
* $Log$ |
* $Log$ |
15 |
|
* Revision 1.2 2003/03/05 12:12:42 joko |
16 |
|
* re-renamed methods and privates: _handler becomes _proxy again |
17 |
|
* |
18 |
* Revision 1.1 2003/03/03 22:05:25 joko |
* Revision 1.1 2003/03/03 22:05:25 joko |
19 |
* abstract implementation... ;-) |
* abstract implementation... ;-) |
20 |
* |
* |
68 |
* |
* |
69 |
*/ |
*/ |
70 |
var $_debug = array( |
var $_debug = array( |
71 |
notice => 0, |
notice => 1, |
72 |
trace => 0, |
trace => 1, |
73 |
payload => 0, |
payload => 1, |
74 |
); |
); |
75 |
|
|
76 |
var $_component_name; |
var $_component_name; |
87 |
* ... or others! (these are just proposals for convenience) |
* ... or others! (these are just proposals for convenience) |
88 |
* |
* |
89 |
*/ |
*/ |
90 |
var $_handler = NULL; |
var $_proxy = NULL; |
91 |
|
|
92 |
|
|
93 |
/** |
/** |
100 |
* ); |
* ); |
101 |
* |
* |
102 |
*/ |
*/ |
103 |
var $_handler_options = NULL; |
var $_proxy_options = NULL; |
104 |
|
|
105 |
|
|
106 |
function about() { |
function about() { |
120 |
|
|
121 |
function constructor($handler = array()) { |
function constructor($handler = array()) { |
122 |
if (sizeof($handler)) { |
if (sizeof($handler)) { |
123 |
$this->set_handler($handler); |
$this->set_proxy($handler); |
124 |
} |
} |
125 |
$this->create_handler(); |
$this->create_proxy(); |
126 |
$this->call_handler(); |
$this->call_proxy(); |
127 |
} |
} |
128 |
|
|
129 |
/* |
/* |
141 |
* @param Handler object - &$handler |
* @param Handler object - &$handler |
142 |
* |
* |
143 |
*/ |
*/ |
144 |
function set_handler( &$handler ) { |
function set_proxy( &$handler ) { |
145 |
$this->_handler = &$handler; |
$this->_proxy = &$handler; |
146 |
} |
} |
147 |
|
|
148 |
function &get_handler() { |
function &get_proxy() { |
149 |
return $this->_handler; |
return $this->_proxy; |
150 |
} |
} |
151 |
|
|
152 |
function call_handler() { |
function call_proxy() { |
153 |
$this->_abstract_method('call_handler', 'DesignPattern::Proxy'); |
$this->_abstract_method('call_proxy', 'DesignPattern::Proxy'); |
154 |
} |
} |
155 |
|
|
156 |
function set_component_name($name) { |
function set_component_name($name) { |
159 |
function get_component_name() { |
function get_component_name() { |
160 |
return $this->_component_name; |
return $this->_component_name; |
161 |
} |
} |
162 |
function set_component_options($options) { |
function set_component_options_v1() { |
163 |
$this->_component_options= $options; |
$options = func_get_args(); |
164 |
|
if (is_array($options)) { |
165 |
|
if (is_hash($options)) { |
166 |
|
$this->_component_options = $options; |
167 |
|
} else { |
168 |
|
$this->_component_options = array(); |
169 |
|
foreach ($options as $option) { |
170 |
|
array_push($this->_component_options, $option); |
171 |
|
} |
172 |
|
} |
173 |
|
} else { |
174 |
|
$this->_component_options = $options; |
175 |
|
} |
176 |
|
} |
177 |
|
function set_component_options() { |
178 |
|
$options = func_get_args(); |
179 |
|
if (sizeof($options) >= 1) { |
180 |
|
$this->_component_options = array(); |
181 |
|
foreach ($options as $option) { |
182 |
|
array_push($this->_component_options, $option); |
183 |
|
} |
184 |
|
} else { |
185 |
|
$this->_component_options = $options; |
186 |
|
} |
187 |
} |
} |
188 |
function get_component_options() { |
function get_component_options() { |
189 |
return $this->_component_options; |
return $this->_component_options; |
190 |
} |
} |
191 |
|
|
192 |
function create_handler() { |
function create_proxy() { |
193 |
//print "DesignPattern::Proxy->create_handler<br/>"; |
//print "DesignPattern::Proxy->create_proxy<br/>"; |
194 |
//print "comp: " . $this->get_component_name() . "<br/>"; |
//print "comp: " . $this->get_component_name() . "<br/>"; |
195 |
//print "comp: " . $this->get_component_options() . "<br/>"; |
//print "comp: " . $this->get_component_options() . "<br/>"; |
196 |
$handler = php::mkComponent( $this->get_component_name(), $this->get_component_options() ); |
$handler = php::mkComponent( $this->get_component_name(), $this->get_component_options() ); |
197 |
//print Dumper($handler); |
//print Dumper($handler); |
198 |
//exit; |
//exit; |
199 |
|
|
200 |
$this->set_handler( $handler ); |
$this->set_proxy( $handler ); |
201 |
} |
} |
202 |
|
|
203 |
|
|