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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (hide annotations)
Wed Mar 5 17:13:17 2003 UTC (21 years, 5 months ago) by joko
Branch: MAIN
Changes since 1.6: +13 -10 lines
updated docu (phpDocumentor testing....)

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

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