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

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