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

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