PEAR logo

PHP_CompatInfo : The Definitive Guide

Name

PHP_CompatInfo::parseData — Parse a data source

Synopsis

    require_once 'PHP/CompatInfo.php';
   
Array PHP_CompatInfo::parseData( $dataSource,  
  $options = array());  
mixed   $dataSource;
array   $options = array();

Description

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.

Parameter

mixed $dataSource

Identify the data source(s)

array $options

An array of common options where:

  • debug Contains a boolean to control whether extra ouput is shown.

  • 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.

An array of specific options, for parseArray parseDir or parseFolder, where:

  • 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.

An array of specific options, for parseArray, where:

  • is_string Contains a boolean which says if the array values are strings or file names.

An array of specific options, for parseDir or parseFolder, where:

  • recurse_dir Boolean on whether to recursively find files

  • ignore_dirs Contains an array of directories to ignore. Directory names are case insensitive.

Throws

throws no exceptions thrown

Since

since version 1.8.0b2 (2008-06-03)

Note

This function can not be called statically.

Return value

array - a hash which contains information keys: ignored_files, ignored_functions, ignored_extensions, ignored_constants, max_version, version, extensions, constants, tokens, cond_code or FALSE on error.

Example

  1. <?php
  2. require_once 'PHP/CompatInfo.php';
  3.  
  4. $source  = '/tmp/File_Find-1.3.0/Find.php';
  5. $options = array('debug' => true);
  6.  
  7. $pci = new PHP_CompatInfo();
  8. $pci->parseData($source, $options);
  9. ?>
PHP_CompatInfo : The Definitive Guide v 1.8.0 : August 1, 2008