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

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