/[cvs]/nfo/php/libs/org.netfrag.glib/DesignPattern/AdapterProxy.php
ViewVC logotype

Contents of /nfo/php/libs/org.netfrag.glib/DesignPattern/AdapterProxy.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations)
Wed Mar 5 16:10:17 2003 UTC (21 years, 4 months ago) by joko
Branch: MAIN
Changes since 1.2: +19 -29 lines
updated docu (phpDocumentor testing....)

1 <?
2 /**
3 * This file contains the DesignPattern::AdapterProxy class
4 *
5 * It combines features from both the standard Proxy
6 * and the TransparentProxy adding some Adapter features
7 *
8 * @author Andreas Motl <andreas.motl@ilo.de>
9 * @package org.netfrag.glib
10 * @name DesignPattern::AdapterProxy
11 *
12 */
13
14 /**
15 * $Id: AdapterProxy.php,v 1.2 2003/03/05 15:41:03 joko Exp $
16 *
17 * $Log: AdapterProxy.php,v $
18 * Revision 1.2 2003/03/05 15:41:03 joko
19 * updated docu (phpDocumentor testing....)
20 *
21 * Revision 1.1 2003/03/05 12:07:10 joko
22 * + initial commit
23 *
24 * Revision 1.1 2003/03/03 22:11:08 joko
25 * + initial commit
26 *
27 *
28 */
29
30
31 /**
32 * This tries to implement some DesignPattern
33 *
34 *
35 * @author Andreas Motl <andreas.motl@ilo.de>
36 * @link http://www.netfrag.org/~joko/
37 * @copyright (c) 2003 - All Rights reserved.
38 * @license GNU LGPL (GNU Lesser General Public License)
39 * @link http://www.gnu.org/licenses/lgpl.txt
40 *
41 * @package org.netfrag.glib
42 * @name DesignPattern::AdapterProxy
43 * @filesource
44 *
45 */
46
47 /**
48 * Make sure we have the required parent class
49 */
50 loadModule('DesignPattern::TransparentProxy');
51
52
53 /**
54 * @todo Learn TransparentProxy to do procedural calls instead
55 * of instantiating a component and even less code could be in here.....
56 * benefit: the TransparentProxy would be become even more powerful
57 * eeäähhh, to the master Proxy it goes......!!! This one calls the handler(s)!
58 *
59 */
60
61
62 class DesignPattern_AdapterProxy extends DesignPattern_TransparentProxy {
63
64 var $_adapter;
65 var $_adapter_module;
66 var $_adapter_options;
67
68 function &get_adapter() {
69 return $this->_adapter;
70 }
71
72 function &set_adapter(&$adapter) {
73 $this->_adapter = &$adapter;
74 }
75
76 // move this code to php::call_func!!! and wrap here!!!
77 function &create_adapter($m, $f, $a, $options = array()) {
78
79 // load required module
80 php::loadModule($m);
81
82 // V0: call-handler tests
83 //$m::$f();
84 //$res = call_user_func(array($m, $f));
85 //call_user_func("$m::$f");
86 //$m->$f();
87
88 // V1:
89 //$res = call_user_func( array( $m, $f ) );
90
91 // V2:
92 //return call_user_func( array( $m, $f ), $a );
93
94 if ($options[object]) {
95 $m = php::mkInstance($m);
96 }
97
98 // V3:
99 $this->set_adapter( call_user_func( array( &$m, $f ), $a ) );
100 return $this->get_adapter();
101
102 //print Dumper($res);
103 //exit;
104
105 // FIXME: use TransparentProxy for this!
106 // V1:
107 //$this = $res;
108 // V2:
109 //$this->make_transparent();
110
111 //return $res;
112
113 }
114
115 function set_adapter_module($name) {
116 $this->_adapter_module = $name;
117 }
118 function get_adapter_module() {
119 return $this->_adapter_module;
120 }
121 function set_adapter_options(&$options) {
122 $this->_adapter_options = &$options;
123 }
124 function get_adapter_options() {
125 return $this->_adapter_options;
126 }
127
128 }
129
130 ?>

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed