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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations)
Mon Mar 3 21:25:51 2003 UTC (21 years, 5 months ago) by joko
Branch: MAIN
+ initial commit

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

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