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