source: sandbox/workflow/branches/609/lib/Factory.php @ 2206

Revision 2206, 878 bytes checked in by pedroerp, 14 years ago (diff)

Ticket #609 - Versão inicial das classes de segurança e fábricas.

  • Property svn:executable set to *
Line 
1<?php
2
3class Factory {
4
5        private static $_unsecuredFactory = null;
6
7        private static $_securedFactory = null;
8
9
10        public function __construct() {
11                throw new Exception("Oops! Static only class.");
12        }
13
14
15        public static function getInstance() {
16
17                /* oops. we are in the process space. */
18                if (Security::isEnabled()) {
19
20                        /* must instatiate it */
21                        if (is_null(self::$_securedFactory))
22                                self::$_securedFactory = new ProcessFactory();
23
24                        $args = func_get_args();
25                        call_user_func_array(array(self::$_securedFactory, "getInstance"), $args);
26
27                }
28                /* regular module space */
29                else {
30
31                        /* must instatiate it */
32                        if (is_null(self::$_unsecuredFactory))
33                                self::$_unsecuredFactory = new WorkflowFactory();
34
35                        $args = func_get_args();
36                        call_user_func_array(array(self::$_unsecuredFactory, "getInstance"), $args);
37                }
38
39        }
40
41        public static function newInstance() {
42
43        }
44}
45
46?>
Note: See TracBrowser for help on using the repository browser.