Source for file CompatInfo.php
Documentation is available at CompatInfo.php
* Copyright (c) 2004-2008, Davey Shafik <davey@php.net>
* Laurent Laville <pear@laurent-laville.org>
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the authors nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* @package PHP_CompatInfo
* @author Davey Shafik <davey@php.net>
* @author Laurent Laville <pear@laurent-laville.org>
* @license http://www.opensource.org/licenses/bsd-license.php BSD
* @version CVS: $Id: CompatInfo.php,v 1.103 2008/07/22 20:27:32 farell Exp $
* @link http://pear.php.net/package/PHP_CompatInfo
* @since File available since Release 0.7.0
require_once 'PHP/CompatInfo/Parser.php';
* Check Compatibility of chunk of PHP code
* This class is the controller in the MVC design pattern of API 1.8.0 (since beta 2)
* @package PHP_CompatInfo
* @author Davey Shafik <davey@php.net>
* @author Laurent Laville <pear@laurent-laville.org>
* @copyright 2003 Davey Shafik and Synaptic Media. All Rights Reserved.
* @license http://www.opensource.org/licenses/bsd-license.php BSD
* @version Release: 1.8.0
* @link http://pear.php.net/package/PHP_CompatInfo
* @since Class available since Release 0.7.0
* Instance of the parser (model in MVC desing pattern)
* Class constructor (ZE1) for PHP4
* @param string $render (optional) Type of renderer to show results
* @param array $conf (optional) A hash containing any additional
* configuration a renderer may use
* @since version 1.8.0b2 (2008-06-03)
* Class constructor (ZE2) for PHP5+
* @param string $render (optional) Type of renderer to show results
* @param array $conf (optional) A hash containing any additional
* configuration a renderer may use
* @since version 1.8.0b2 (2008-06-03)
function __construct($render = 'array', $conf = array ())
$this->parser->setOutputDriver ($render, $conf);
* Registers a new listener
* Registers a new listener with the given criteria.
* @param mixed $callback A PHP callback
* @param string $nName (optional) Expected notification name
* @since version 1.8.0b3 (2008-06-07)
function addListener($callback, $nName = EVENT_DISPATCHER_GLOBAL )
$this->parser->addListener ($callback, $nName);
* Removes a registered listener
* Removes a registered listener that correspond to the given criteria.
* @param mixed $callback A PHP callback
* @param string $nName (optional) Expected notification name
* @return bool True if listener was removed, false otherwise.
* @since version 1.8.0b3 (2008-06-07)
return $this->parser->removeListener ($callback, $nName);
* Load components list for a PHP version or subset
* @param string $min PHP minimal version
* @param string|boolean$max (optional) PHP maximal version
* @param boolean $include_const (optional) include constants list
* @param boolean $groupby_vers (optional) give initial php version
* of function or constant
* @return array An array of php function/constant names history
* @since version 1.2.0 (2006-08-23)
$include_const = false , $groupby_vers = false )
return $this->parser->loadVersion ($min, $max, $include_const, $groupby_vers);
* Parse a data source with auto detect ability. This data source, may be
* one of these follows: a directory, a file, a string (chunk of code),
* an array of multiple origin.
* Each of five parsing functions support common and specifics options.
* - 'debug' Contains a boolean to control whether
* - 'ignore_functions' Contains an array of functions to ignore
* when calculating the version needed.
* - 'ignore_constants' Contains an array of constants to ignore
* when calculating the version needed.
* - 'ignore_extensions' Contains an array of php extensions to ignore
* when calculating the version needed.
* - 'ignore_versions' Contains an array of php versions to ignore
* when calculating the version needed.
* - 'ignore_functions_match' Contains an array of function patterns to ignore
* when calculating the version needed.
* - 'ignore_extensions_match' Contains an array of extension patterns to ignore
* when calculating the version needed.
* - 'ignore_constants_match' Contains an array of constant patterns to ignore
* when calculating the version needed.
* * parseArray, parseDir|parseFolder, specific options :
* - 'file_ext' Contains an array of file extensions to parse
* for PHP code. Default: php, php4, inc, phtml
* - 'ignore_files' Contains an array of files to ignore.
* File names are case insensitive.
* * parseArray specific options :
* - 'is_string' Contains a boolean which says if the array values
* are strings or file names.
* * parseDir|parseFolder specific options :
* - 'recurse_dir' Boolean on whether to recursively find files
* - 'ignore_dirs' Contains an array of directories to ignore.
* Directory names are case insensitive.
* @param mixed $data Data source (may be file, dir, string, or array)
* @param array $options An array of options. See above.
* @return array or false on error
* @since version 1.8.0b2 (2008-06-03)
* @see PHP_CompatInfo_Parser::parseData()
function parseData($data, $options = array ())
return $this->parser->parseData ($data, $options);
* Parse an Array of Files or Strings
* You can parse an array of Files or Strings, to parse
* strings, $options['is_string'] must be set to true.
* This recommandation is no more valid since version 1.8.0b2
* Array my contains multiple and mixed origin (file, dir, string).
* @param array $array Array of data sources
* @param array $options Parser options (see parseData() method for details)
* @return array or false on error
* @since version 0.7.0 (2004-03-09)
return $this->parser->parseData ($array, $options);
* Parse a string for its compatibility info
* @param string $string PHP Code to parse
* @param array $options Parser options (see parseData() method for details)
* @return array or false on error
* @since version 0.7.0 (2004-03-09)
return $this->parser->parseData ($string, $options);
* Parse a file for its compatibility info
* @param string $file Path of File to parse
* @param array $options Parser options (see parseData() method for details)
* @return array or false on error
* @since version 0.7.0 (2004-03-09)
function parseFile($file, $options = array ())
return $this->parser->parseData ($file, $options);
* Parse a directory recursively for its compatibility info
* @param string $dir Path of folder to parse
* @param array $options Parser options (see parseData() method for details)
* @return array or false on error
* @since version 0.8.0 (2004-04-22)
function parseDir($dir, $options = array ())
return $this->parser->parseData ($dir, $options);
* Alias of parseDir function
* @param string $folder Path of folder to parse
* @param array $options Parser options (see parseData() method for details)
* @return array or false on error
* @since version 0.7.0 (2004-03-09)
* @see parseDir(), parseData()
return $this->parser->parseData ($folder, $options);
Documentation generated on Fri, 01 Aug 2008 11:30:22 -0400 by phpDocumentor 1.4.0. PEAR Logo Copyright © PHP Group 2004.
|