/[cvs]/nfo/php/libs/org.netfrag.glib/Class/Abstract.php
ViewVC logotype

Contents of /nfo/php/libs/org.netfrag.glib/Class/Abstract.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (show annotations)
Sat Apr 5 21:21:44 2003 UTC (21 years, 3 months ago) by joko
Branch: MAIN
CVS Tags: HEAD
Changes since 1.4: +14 -3 lines
modified debug-/log-message building

1 <?php
2 /**
3 * This file contains the Class::Abstract class.
4 *
5 * @author Andreas Motl <andreas.motl@ilo.de>
6 * @package org.netfrag.glib
7 * @name Class::Abstract
8 *
9 */
10
11 /**
12 * <b>Cvs-Log:</b>
13 *
14 * <pre>
15 * $Id: Abstract.php,v 1.4 2003/03/11 01:10:00 joko Exp $
16 *
17 * $Log: Abstract.php,v $
18 * Revision 1.4 2003/03/11 01:10:00 joko
19 * + fixed metadata for phpDocumentor
20 *
21 * Revision 1.3 2003/03/10 23:45:30 joko
22 * + fixed metadata for phpDocumentor
23 *
24 * Revision 1.2 2003/03/05 18:54:43 joko
25 * updated docu - phpDocumentor is very strict about its 'blocks'...
26 *
27 * Revision 1.1 2003/03/03 21:25:51 joko
28 * + initial commit
29 * </pre>
30 *
31 */
32
33
34 /**
35 * --- An attempt to implement some software design patterns...
36 *
37 * @author Andreas Motl <andreas.motl@ilo.de>
38 * @copyright (c) 2003 - All Rights reserved.
39 * @license GNU LGPL (GNU Lesser General Public License)
40 *
41 * @link http://www.netfrag.org/~joko/
42 * @link http://www.gnu.org/licenses/lgpl.txt
43 *
44 * @package org.netfrag.glib
45 * @subpackage Class
46 * @name Class::Abstract
47 *
48 */
49 class Class_Abstract {
50
51 // --- "core"
52
53 function __call_abstract_method($method, $required_by = '', $message = '') {
54
55 /*
56 $address = array();
57 array_push($address, "DesignPattern::Facade", $package_p, $package);
58 */
59
60 $inheritance_tree = php::get_ancestors_class($this);
61 array_push($inheritance_tree, get_class($this));
62
63 $buf_arr = array();
64 $indent = '';
65 foreach ($inheritance_tree as $class) {
66 array_push($buf_arr, $indent . $class);
67 $indent .= ' ';
68 }
69 $buf = join(' -> ' . "\n", $buf_arr);
70
71 //$out = "Base class '$required_by' requires method '$method' to be implemented in inherited class. inheritance_tree: [$inheritance_tree_serialized] (additional info: $message)";
72 $out = "<pre>Class '$required_by' requires method '$method' to be implemented.\ninheritance tree: {\n$buf\n}\n(additional info: $message)</pre>";
73 user_error($out);
74
75 $this->__call_concrete_methods(array('about', 'usage'));
76
77 }
78
79 function __call_concrete_method($method, $args = array()) {
80 if (method_exists($this, $method)) { $this->$method($args); }
81 }
82
83 function __call_concrete_methods($methods = array(), $args = array()) {
84 foreach ($methods as $method) {
85 $this->__call_concrete_method($method, $args);
86 }
87 }
88
89
90 // --- "api"
91
92 function _abstract_method($method, $required_by = '', $message = '') {
93 $this->__call_abstract_method($method, $required_by, $message);
94 }
95
96 function _concrete_method($method, $args = array()) {
97 $this->__call_concrete_method($method, $args);
98 }
99
100 function usage() {
101 print "<pre>" . htmlentities($this->_about) . "</pre>";
102 }
103
104 }
105
106 ?>

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