/[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.4 - (show annotations)
Tue Mar 11 01:10:00 2003 UTC (21 years, 5 months ago) by joko
Branch: MAIN
Changes since 1.3: +9 -2 lines
+ fixed metadata for phpDocumentor

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

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