1 | <?php |
---|
2 | /**************************************************************************\ |
---|
3 | * eGroupWare * |
---|
4 | * http://www.egroupware.org * |
---|
5 | * -------------------------------------------- * |
---|
6 | * This program is free software; you can redistribute it and/or modify it * |
---|
7 | * under the terms of the GNU General Public License as published by the * |
---|
8 | * Free Software Foundation; either version 2 of the License, or (at your * |
---|
9 | * option) any later version. * |
---|
10 | \**************************************************************************/ |
---|
11 | |
---|
12 | /** |
---|
13 | * This class is temporary. We just need to use it until all the |
---|
14 | * processes are updated and using our new static factory. The |
---|
15 | * only purpose of this class is to forward the calls to our |
---|
16 | * frontend factory class. Formally, it's an Adapter Design Pattern. |
---|
17 | * |
---|
18 | * @package Factory |
---|
19 | * @license http://www.gnu.org/copyleft/gpl.html GPL |
---|
20 | * @author Pedro Eugênio Rocha - pedro.eugenio.rocha@gmail.com |
---|
21 | */ |
---|
22 | class ProcessWrapperFactory |
---|
23 | { |
---|
24 | |
---|
25 | /** |
---|
26 | * Just forward the call. |
---|
27 | * |
---|
28 | * @access public |
---|
29 | * @return object |
---|
30 | */ |
---|
31 | public function &getInstance() { |
---|
32 | |
---|
33 | $args = func_get_args(); |
---|
34 | |
---|
35 | /** |
---|
36 | * To save memory and processing, we store caches of objects instantiated |
---|
37 | * by the factory. When we use this beautiful function (call_user_func_array), |
---|
38 | * it makes an unexpected copy of the object. Of course we don't want it. |
---|
39 | * For now, we will keep doing copies. |
---|
40 | */ |
---|
41 | return call_user_func_array(array(Factory, "getInstance"), $args); |
---|
42 | |
---|
43 | } |
---|
44 | |
---|
45 | |
---|
46 | /** |
---|
47 | * Just forward the call. |
---|
48 | * |
---|
49 | * @access public |
---|
50 | * @return object |
---|
51 | */ |
---|
52 | public function &newInstance() { |
---|
53 | |
---|
54 | $args = func_get_args(); |
---|
55 | |
---|
56 | /* read the comment above */ |
---|
57 | return call_user_func_array(array(Factory, "newInstance"), $args); |
---|
58 | |
---|
59 | } |
---|
60 | } |
---|
61 | ?> |
---|