1 |
<? |
2 |
// --------------------------------------------------------------------------- |
3 |
// $Id: Object.php,v 1.1 2003/02/03 03:33:48 joko Exp $ |
4 |
// --------------------------------------------------------------------------- |
5 |
// $Log: Object.php,v $ |
6 |
// Revision 1.1 2003/02/03 03:33:48 joko |
7 |
// + initial commit |
8 |
// |
9 |
// --------------------------------------------------------------------------- |
10 |
|
11 |
|
12 |
|
13 |
/* |
14 |
class DesignPattern_Object { |
15 |
function DesignPattern_Object() { |
16 |
|
17 |
} |
18 |
} |
19 |
*/ |
20 |
|
21 |
function _ns2file($nsName) { |
22 |
if ($filename = str_replace('::', '/', $nsName)) { |
23 |
$filename .= '.php'; |
24 |
return $filename; |
25 |
} |
26 |
} |
27 |
|
28 |
function mkObject($namespacedClassname, $attributes = null) { |
29 |
$classname = $namespacedClassname; |
30 |
if (loadModule($namespacedClassname)) { |
31 |
$classname = str_replace('::', '_', $namespacedClassname); |
32 |
} |
33 |
$obj = new DesignPattern_Bridge($classname, $attributes); |
34 |
return $obj; |
35 |
} |
36 |
|
37 |
function loadModule($namespacedClassname) { |
38 |
if ($filename = _ns2file($namespacedClassname)) { |
39 |
require_once($filename); |
40 |
return 1; |
41 |
} |
42 |
} |
43 |
|
44 |
?> |