/[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.6 - (show annotations)
Wed Mar 5 17:02:22 2003 UTC (21 years, 5 months ago) by joko
Branch: MAIN
Changes since 1.5: +11 -7 lines
updated docu (phpDocumentor testing....)

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

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