Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
/**
3
 * Test tokens that appeared in PHP 5
4
 *    T_ABSTRACT
5
 *    T_CATCH
6
 *    T_FINAL
7
 *    T_INSTANCEOF
8
 *    T_PRIVATE
9
 *    T_PROTECTED
10
 *    T_PUBLIC
11
 *    T_THROW
12
 *    T_TRY
13
 *    T_CLONE
14
 *    T_INTERFACE
15
 *    T_IMPLEMENTS
16
 *
17
 * PHP versions 4 and 5
18
 *
19
 * @category PHP
20
 * @package  PHP_CompatInfo
21
 * @author   Laurent Laville <pear@laurent-laville.org>
22
 * @license  http://www.opensource.org/licenses/bsd-license.php  BSD
23
 * @version  CVS: $Id: checkPHP5.php,v 1.7 2008/07/22 21:13:14 farell Exp $
24
 * @link     http://pear.php.net/package/PHP_CompatInfo
25
 * @ignore
26
 */
27
 
28
require_once 'PHP/CompatInfo.php';
29
 
30
/**
31
 * @ignore
32
 */
33
abstract class AbstractClass
34
{
35
    abstract protected function getValue();
36
}
37
/**
38
 * @ignore
39
 */
40
interface ITemplate
41
{
42
    public function setVariable($name, $var);
43
    public function getHtml($template);
44
}
45
/**
46
 * @ignore
47
 */
48
class Template implements ITemplate
49
{
50
    private $vars = array();
51
 
52
    public function setVariable($name, $var)
53
    {
54
        $this->vars[$name] = $var;
55
    }
56
 
57
    public function getHtml($template)
58
    {
59
        foreach ($this->vars as $name => $value) {
60
            $template = str_replace('{' . $name . '}', $value, $template);
61
        }
62
        return $template;
63
    }
64
}
65
/**
66
 * @ignore
67
 */
68
class BaseClass
69
{
70
    public $objet1;
71
    public $objet2;
72
 
73
    public function __construct()
74
    {
75
    }
76
 
77
    public function __clone()
78
    {
79
        $this->object1 = clone($this->object1);
80
    }
81
 
82
    private function foo()
83
    {
84
    }
85
 
86
    protected function bar()
87
    {
88
        if ($this->object1 instanceof BaseClass) {
89
            return;
90
        }
91
 
92
        try {
93
            $error = 'my error';
94
            throw new Exception($error);
95
 
96
        } catch(Exception $__bar_exception) {
97
 
98
        }
99
    }
100
 
101
    final public function moreTesting()
102
    {
103
        echo "BaseClass::moreTesting() called \n";
104
    }
105
}
106
 
107
$info = new PHP_CompatInfo();
108
 
109
$file    = __FILE__;
110
$options = array('debug' => true);
111
 
112
$r = $info->parseFile($file, $options);
113
/*
114
   To keep backward compatibility, result is also return (here in $r)
115
   but you don't need to print it, it's the default behavior of API 1.8.0
116
 */
117
//var_export($r);
118
?>