Uncommited changes synced
[PHP_CodeDoc] / CodeDoc / Data / PhpDoc.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
20 /**
21 *   Phpdoc data container
22 *
23 *   @package  PHP_CodeDoc
24 *   @access   public
25 *   @author   Alan Knowles <alan@akbkhome.com>
26 *
27 */
28
29 require_once 'Param.php';
30
31 class PHP_CodeDoc_Data_PhpDoc {
32     var $long = "";             // name of parameter
33     var $short = "";            // default value
34     var $original;              // original text of comment
35     var $param = array();       //@param        type    $varname        description
36     var $return;                //@return       type    description
37     var $access;                //@access       public or private
38     var $author;                //@author       author name 
39     var $copyright;             //@copyright    name date
40     var $version;               //@version      version
41     var $see;                   //@see          name of another element that can be documented, produces a link to it in the documentation
42     var $link;                  //@link         a url
43     var $since;                 //@since        a version or a date
44     var $deprecacted;           //@deprecated|@deprec   description
45     var $magic;                 //@magic                 phpdoc.de compatibility
46     var $todo;                  //@todo         phpdoc.de compatibility
47     var $exception;             //@exception    Javadoc-compatible, use as needed
48     var $throws;                //@throws       Javadoc-compatible, use as needed
49     var $var;                   //@var          type    a data type for a class variable
50     var $package;               //@package      package name
51    
52     var $subpackage;            //@subpackage   sub package name, groupings inside of a project
53     
54     function __construct()
55     {
56         $this->return = new PHP_CodeDoc_Data_Param();
57        
58     }
59     
60     function longToHTML()
61     {
62         $ret = '<p>'. $this->long .'</p>';
63         $ret = preg_replace('/\n\s+\n/','</p><p>',$ret);
64         
65         $bits = explode('```', $ret);
66         
67         if (count($bits) > 1) {
68             $otag = $tag ='<br/><code style="white-space: pre">';
69             $ret = '';
70             foreach($bits as $b) {
71                 //if ($tag == '</code><br/>') {
72             //    $b = preg_replace('/\n/', "<br/>\n", $b);
73              //   }
74                 $ret .= $b . $tag;
75                 $tag = $tag == $otag ? '</code><br/>' : $otag;
76             }
77         }
78         // code....
79         
80         return $ret;
81         
82         
83         
84         
85     }
86     
87 }
88