PageRenderTime 3ms CodeModel.GetById 83ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/PHP/CompatInfo/Reference/pdo.php

http://github.com/llaville/php-compat-info
PHP | 206 lines | 111 code | 13 blank | 82 comment | 32 complexity | 0adfdd11daa42e3e44509dedee6548d6 MD5 | raw file
  1<?php
  2/**
  3 * Version informations about PDO 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 PDO 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.pdo.php
 25 */
 26class PHP_CompatInfo_Reference_PDO 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            'PDO' => array('5.1.0', '', '1.0.4dev')
 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.pdoexception.php
108     * @link   http://www.php.net/manual/en/class.pdo.php
109     * @link   http://www.php.net/manual/en/class.pdostatement.php
110     */
111    public function getClasses($extension = null, $version = null)
112    {
113        $classes = array();
114
115        if ((null == $version ) || ('4' == $version)) {
116            $version4 = array(
117            );
118            $classes = array_merge(
119                $classes,
120                $version4
121            );
122        }
123        if ((null == $version ) || ('5' == $version)) {
124            $version5 = array(
125                'PDOException'                   => array('5.1.0', ''),
126                'PDO'                            => array('5.1.0', ''),
127                'PDOStatement'                   => array('5.1.0', ''),
128                'PDORow'                         => array('5.1.0', ''),
129            );
130            $classes = array_merge(
131                $classes,
132                $version5
133            );
134        }
135
136        return $classes;
137    }
138
139    /**
140     * Gets informations about functions
141     *
142     * @param string $extension OPTIONAL
143     * @param string $version   OPTIONAL PHP version
144     *                          (4 => only PHP4, 5 or null => PHP4 + PHP5)
145     *
146     * @return array
147     */
148    public function getFunctions($extension = null, $version = null)
149    {
150        $functions = array();
151
152        if ((null == $version ) || ('4' == $version)) {
153            $version4 = array(
154            );
155            $functions = array_merge(
156                $functions,
157                $version4
158            );
159        }
160        if ((null == $version ) || ('5' == $version)) {
161            $version5 = array(
162                'pdo_drivers'                       => array('5.1.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     * @link   http://www.php.net/manual/en/pdo.constants.php
181     */
182    public function getConstants($extension = null, $version = null)
183    {
184        $constants = array();
185
186        if ((null == $version ) || ('4' == $version)) {
187            $version4 = array(
188            );
189            $constants = array_merge(
190                $constants,
191                $version4
192            );
193        }
194        if ((null == $version ) || ('5' == $version)) {
195            $version5 = array(
196            );
197            $constants = array_merge(
198                $constants,
199                $version5
200            );
201        }
202
203        return $constants;
204    }
205
206}