PageRenderTime 21ms CodeModel.GetById 15ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/PHP/CompatInfo/Reference/simplexml.php

http://github.com/llaville/php-compat-info
PHP | 205 lines | 111 code | 13 blank | 81 comment | 32 complexity | f579fe8648d9b19a5e5b64dc8f22c3fe MD5 | raw file
  1<?php
  2/**
  3 * Version informations about SimpleXML extension
  4 *
  5 * PHP version 5
  6 *
  7 * @category PHP
  8 * @package  PHP_CompatInfo
  9 * @author   Laurent Laville <pear@laurent-laville.org>
 10 * @license  http://www.opensource.org/licenses/bsd-license.php  BSD License
 11 * @version  SVN: $Id$
 12 * @link     http://php5.laurent-laville.org/compatinfo/
 13 */
 14
 15/**
 16 * All interfaces, classes, functions, constants about SimpleXML extension
 17 *
 18 * @category PHP
 19 * @package  PHP_CompatInfo
 20 * @author   Laurent Laville <pear@laurent-laville.org>
 21 * @license  http://www.opensource.org/licenses/bsd-license.php  BSD License
 22 * @version  Release: @package_version@
 23 * @link     http://php5.laurent-laville.org/compatinfo/
 24 * @link     http://www.php.net/manual/en/book.simplexml.php
 25 */
 26class PHP_CompatInfo_Reference_SimpleXML implements PHP_CompatInfo_Reference
 27{
 28    /**
 29     * Gets all informations at once about:
 30     * extensions, interfaces, classes, functions, constants
 31     *
 32     * @param string $extension OPTIONAL
 33     * @param string $version   OPTIONAL PHP version
 34     *                          (4 => only PHP4, 5 or null => PHP4 + PHP5)
 35     *
 36     * @return array
 37     */
 38    public function getAll($extension = null, $version = null)
 39    {
 40        $references = array(
 41            'extensions' => $this->getExtensions($extension, $version),
 42            'interfaces' => $this->getInterfaces($extension, $version),
 43            'classes'    => $this->getClasses($extension, $version),
 44            'functions'  => $this->getFunctions($extension, $version),
 45            'constants'  => $this->getConstants($extension, $version),
 46        );
 47        return $references;
 48    }
 49
 50    /**
 51     * Gets informations about extensions
 52     *
 53     * @param string $extension OPTIONAL
 54     * @param string $version   OPTIONAL PHP version
 55     *                          (4 => only PHP4, 5 or null => PHP4 + PHP5)
 56     *
 57     * @return array
 58     */
 59    public function getExtensions($extension = null, $version = null)
 60    {
 61        $extensions = array(
 62            'SimpleXML' => array('5.0.0', '', '0.1')
 63        );
 64        return $extensions;
 65    }
 66
 67    /**
 68     * Gets informations about interfaces
 69     *
 70     * @param string $extension OPTIONAL
 71     * @param string $version   OPTIONAL PHP version
 72     *                          (4 => only PHP4, 5 or null => PHP4 + PHP5)
 73     *
 74     * @return array
 75     */
 76    public function getInterfaces($extension = null, $version = null)
 77    {
 78        $interfaces = array();
 79
 80        if ((null == $version ) || ('4' == $version)) {
 81            $version4 = array(
 82            );
 83            $interfaces = array_merge(
 84                $interfaces,
 85                $version4
 86            );
 87        }
 88        if ((null == $version ) || ('5' == $version)) {
 89            $version5 = array(
 90            );
 91            $interfaces = array_merge(
 92                $interfaces,
 93                $version5
 94            );
 95        }
 96        return $interfaces;
 97    }
 98
 99    /**
100     * Gets informations about classes
101     *
102     * @param string $extension OPTIONAL
103     * @param string $version   OPTIONAL PHP version
104     *                          (4 => only PHP4, 5 or null => PHP4 + PHP5)
105     *
106     * @return array
107     * @link   http://www.php.net/manual/en/class.simplexmlelement.php
108     * @link   http://www.php.net/manual/en/class.simplexmliterator.php
109     */
110    public function getClasses($extension = null, $version = null)
111    {
112        $classes = array();
113
114        if ((null == $version ) || ('4' == $version)) {
115            $version4 = array(
116            );
117            $classes = array_merge(
118                $classes,
119                $version4
120            );
121        }
122        if ((null == $version ) || ('5' == $version)) {
123            $version5 = array(
124                'SimpleXMLElement'               => array('5.0.1', ''),
125                'SimpleXMLIterator'              => array('5.1.0', ''),
126            );
127            $classes = array_merge(
128                $classes,
129                $version5
130            );
131        }
132
133        return $classes;
134    }
135
136    /**
137     * Gets informations about functions
138     *
139     * @param string $extension OPTIONAL
140     * @param string $version   OPTIONAL PHP version
141     *                          (4 => only PHP4, 5 or null => PHP4 + PHP5)
142     *
143     * @return array
144     * @link   http://www.php.net/manual/en/ref.simplexml.php
145     */
146    public function getFunctions($extension = null, $version = null)
147    {
148        $functions = array();
149
150        if ((null == $version ) || ('4' == $version)) {
151            $version4 = array(
152            );
153            $functions = array_merge(
154                $functions,
155                $version4
156            );
157        }
158        if ((null == $version ) || ('5' == $version)) {
159            $version5 = array(
160                'simplexml_import_dom'           => array('5.0.0', ''),
161                'simplexml_load_file'            => array('5.0.0', ''),
162                'simplexml_load_string'          => array('5.0.0', ''),
163            );
164            $functions = array_merge(
165                $functions,
166                $version5
167            );
168        }
169        return $functions;
170    }
171
172    /**
173     * Gets informations about constants
174     *
175     * @param string $extension OPTIONAL
176     * @param string $version   OPTIONAL PHP version
177     *                          (4 => only PHP4, 5 or null => PHP4 + PHP5)
178     *
179     * @return array
180     */
181    public function getConstants($extension = null, $version = null)
182    {
183        $constants = array();
184
185        if ((null == $version ) || ('4' == $version)) {
186            $version4 = array(
187            );
188            $constants = array_merge(
189                $constants,
190                $version4
191            );
192        }
193        if ((null == $version ) || ('5' == $version)) {
194            $version5 = array(
195            );
196            $constants = array_merge(
197                $constants,
198                $version5
199            );
200        }
201
202        return $constants;
203    }
204
205}