Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
/**
3
 * Sample File 2, phpDocumentor Quickstart
4
 *
5
 * This file demonstrates the rich information that can be included in
6
 * in-code documentation through DocBlocks and tags.
7
 * @author Greg Beaver <cellog@php.net>
8
 * @version 1.0
9
 * @package sample
10
 */
11
// sample file #1
12
/**
13
 * Dummy include value, to demonstrate the parsing power of phpDocumentor
14
 */
15
include_once 'sample3.php';
16
 
17
/**
18
 * Special global variable declaration DocBlock
19
 * @global integer $GLOBALS['_myvar']
20
 * @name $_myvar
21
 */
22
$GLOBALS['_myvar'] = 6;
23
 
24
/**#@+
25
 * Constants
26
 */
27
/**
28
 * first constant
29
 */
30
define('testing', 6);
31
/**
32
 * second constant
33
 */
34
define('anotherconstant', strlen('hello'));
35
 
36
/**
37
 * A sample function docblock
38
 * @global string document the fact that this function uses $_myvar
39
 * @staticvar integer $staticvar this is actually what is returned
40
 * @param string $param1 name to declare
41
 * @param string $param2 value of the name
42
 * @return integer
43
 */
44
function firstFunc($param1, $param2 = 'optional')
45
{
46
    static $staticvar = 7;
47
    global $_myvar;
48
    return $staticvar;
49
}
50
 
51
/**
52
 * The first example class, this is in the same package as the
53
 * procedural stuff in the start of the file
54
 * @package sample
55
 * @subpackage classes
56
 */
57
class myclass {
58
    /**
59
     * A sample private variable, this can be hidden with the --parseprivate
60
     * option
61
     * @access private
62
     * @var integer|string
63
     */
64
    var $firstvar = 6;
65
    /**
66
     * @link http://www.example.com Example link
67
     * @see myclass()
68
     * @uses testing, anotherconstant
69
     * @var array
70
     */
71
    var $secondvar =
72
        array(
73
            'stuff' =>
74
                array(
75
                    6,
76
                    17,
77
                    'armadillo'
78
                ),
79
            testing => anotherconstant
80
        );
81
 
82
    /**
83
     * Constructor sets up {@link $firstvar}
84
     */
85
    function myclass()
86
    {
87
        $this->firstvar = 7;
88
    }
89
 
90
    /**
91
     * Return a thingie based on $paramie
92
     * @param boolean $paramie
93
     * @return integer|babyclass
94
     */
95
    function parentfunc($paramie)
96
    {
97
        if ($paramie) {
98
            return 6;
99
        } else {
100
            return new babyclass;
101
        }
102
    }
103
}
104
 
105
/**
106
 * @package sample1
107
 */
108
class babyclass extends myclass {
109
    /**
110
     * The answer to Life, the Universe and Everything
111
     * @var integer
112
     */
113
    var $secondvar = 42;
114
    /**
115
     * Configuration values
116
     * @var array
117
     */
118
    var $thirdvar;
119
 
120
    /**
121
     * Calls parent constructor, then increments {@link $firstvar}
122
     */
123
    function babyclass()
124
    {
125
        parent::myclass();
126
        $this->firstvar++;
127
    }
128
 
129
    /**
130
     * This always returns a myclass
131
     * @param ignored $paramie
132
     * @return myclass
133
     */
134
    function parentfunc($paramie)
135
    {
136
        return new myclass;
137
    }
138
}
139
?>