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

Contents of /nfo/php/libs/org.netfrag.glib/DesignPattern/Object.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations)
Mon Feb 3 05:01:48 2003 UTC (21 years, 7 months ago) by joko
Branch: MAIN
Changes since 1.1: +7 -4 lines
+ now attributes can get passed in to the constructors

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 ?>

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