07545af077a86425d4f79b45614868c84d46e8ba
[PHP_CodeDoc] / CodeDoc / Data / Class.php
1 <?php
2
3 // +----------------------------------------------------------------------+
4 // | PHP Version 4                                                        |
5 // +----------------------------------------------------------------------+
6 // | Copyright (c) 1997-2002 The PHP Group                                |
7 // +----------------------------------------------------------------------+
8 // | This source file is subject to version 2.02 of the PHP license,      |
9 // | that is bundled with this package in the file LICENSE, and is        |
10 // | available at through the world-wide-web at                           |
11 // | http://www.php.net/license/2_02.txt.                                 |
12 // | If you did not receive a copy of the PHP license and are unable to   |
13 // | obtain it through the world-wide-web, please send a note to          |
14 // | license@php.net so we can mail you a copy immediately.               |
15 // +----------------------------------------------------------------------+
16 // | Authors: Alan Knowles <alan@akbkhome.com>                      |
17 // +----------------------------------------------------------------------+
18 //
19 require_once 'PHP/CodeDoc/Data.php';
20 /**
21 *   Class Data Container
22 *
23 *   @package  PHP_CodeDoc
24 *   @access   public
25 *   @author   Alan Knowles <alan@akbkhome.com>
26 *
27 */
28 class PHP_CodeDoc_Data_Class {
29     var $id;                     // id in the big classes array.
30     var $name;                   // the name of the class
31     var $filename;               // original filename
32     var $rfilename;              // relative filename in relation to root directory.
33     var $rdir;                   // relative directory
34     var $Parent;                 // Parent Class (maybe an array in PHP5?)
35     var $Operations =array();    // Array of Method Classes
36     var $Attributes =array();    // Array of Var Classes
37     var $iOperations =array();    // Array of inherited Method Classes
38     var $iAttributes =array();    // Array of inherited Var Classes
39   
40     var $package="";             // package name if any
41     var $copyright;              // copyright
42     var $extends = array();      // Array of Parents (names)
43   
44     var $description;            // phpdoc class
45
46     
47     function output_extends() { // cheesy tree?? = better ideas;
48         $indent=0;
49         $t = count($this->extends) -1;
50         for ($i=0;$i<$t+1;$i++) {
51             echo "\n";
52             if ($i)
53                 echo str_repeat('   ',$i) . "|\n". str_repeat('   --',$i);
54
55             //if ($i != $t) { // last one = no link
56                 echo '<a href="'.$this->extends[$i].'.html">'.$this->extends[$i].'</a>';
57             //} else {
58                 //echo $this->extends[$i];
59             //}
60         }
61     } 
62 // move later to inherited
63     function toJS()
64     {
65         $ret = array();
66         $cats = array();
67         foreach($this->Operations as $op) {
68             
69             if (!isset($op->description->category)) {
70                 echo "missing Category for {$this->name}::{$op->name}\n";
71             } else {
72                 $cats[$op->description->category] = isset($cats[$op->description->category]) ? $cats[$op->description->category] : array();
73                 $cats[$op->description->category][] =  $op->name;
74             }
75             $ret[str_replace('_','-',strtolower($this->name)). '/'.$op->name] = $op->toJS();
76         }
77         foreach($this->Attributes as $op) {
78          //   $ret[$this->name . '.'.$op->name] = $op->toJS();
79         }
80         $ret[ $this->name] = array();
81         foreach($cats as $k=>$v ) {
82             $ret[ $this->name][$k] = $this->catsToJs($v);
83         }
84         
85     
86         return $ret;
87     }
88     
89     function catsToJs($ar)
90     {
91         
92         
93         
94         
95     }
96     
97     
98
99 }
100 ?>