C:\xampp\php\pear\PHP\CompatInfo.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
<?php
/**
 * Copyright (c) 2004-2009, Davey Shafik <davey@php.net>
 *                          Laurent Laville <pear@laurent-laville.org>
 *
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 *     * 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.
 *
 * PHP versions 4 and 5
 *
 * @category PHP
 * @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.108 2009/01/02 10:18:47 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)
 *
 * @category  PHP
 * @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.9.0
 * @link      http://pear.php.net/package/PHP_CompatInfo
 * @since     Class available since Release 0.7.0
 */
class PHP_CompatInfo
{
    
/**
     * Instance of the parser (model in MVC desing pattern)
     *
     * @var    object
     * @since  1.8.0b2
     * @access protected
     */
    
var $parser;

    
/**
     * 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
     *
     * @access public
     * @since  version 1.8.0b2 (2008-06-03)
     */
    
function PHP_CompatInfo($render 'array'$conf = array())
    {
        
$this->__construct($render$conf);
    }

    
/**
     * 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
     *
     * @access public
     * @since  version 1.8.0b2 (2008-06-03)
     */
    
function __construct($render 'array'$conf = array())
    {
        
$this->parser = new PHP_CompatInfo_Parser();
        
$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
     *
     * @access public
     * @return void
     * @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
     *
     * @access public
     * @return bool  True if listener was removed, false otherwise.
     * @since  version 1.8.0b3 (2008-06-07)
     */
    
function removeListener($callback$nName EVENT_DISPATCHER_GLOBAL)
    {
        return 
$this->parser->removeListener($callback$nName);
    }

    
/**
     * Load components list
     *
     * 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
     *                                                 in final result
     * @param boolean        $groupby_vers  (optional) give initial php version
     *                                                 of function or constant
     *
     * @return array         An array of php function/constant names history
     * @access public
     * @static
     * @since  version 1.2.0 (2006-08-23)
     */
    
function loadVersion($min$max false,
                         
$include_const false$groupby_vers false)
    {
        return 
$this->parser->loadVersion($min$max$include_const$groupby_vers);
    }

    
/**
     * Parse a data source
     *
     * 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.
     *
     *  * Common options :
     *  - '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.
     *
     *  * 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.
     *
     * @access public
     * @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)
     *
     * @access public
     * @return array or false on error
     * @since  version 0.7.0 (2004-03-09)
     * @see    parseData()
     */
    
function parseArray($array$options = array())
    {
        return 
$this->parser->parseData($array$options);
    }

    
/**
     * Parse a string
     *
     * Parse a string for its compatibility info
     *
     * @param string $string  PHP Code to parse
     * @param array  $options Parser options (see parseData() method for details)
     *
     * @access public
     * @return array or false on error
     * @since  version 0.7.0 (2004-03-09)
     * @see    parseData()
     */
    
function parseString($string$options = array())
    {
        return 
$this->parser->parseData($string$options);
    }

    
/**
     * Parse a single file
     *
     * 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)
     *
     * @access public
     * @return array or false on error
     * @since  version 0.7.0 (2004-03-09)
     * @see    parseData()
     */
    
function parseFile($file$options = array())
    {
        return 
$this->parser->parseData($file$options);
    }

    
/**
     * Parse a directory
     *
     * 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)
     *
     * @access public
     * @return array or false on error
     * @since  version 0.8.0 (2004-04-22)
     * @see    parseData()
     */
    
function parseDir($dir$options = array())
    {
        return 
$this->parser->parseData($dir$options);
    }

    
/**
     * Alias of parseDir
     *
     * Alias of parseDir function
     *
     * @param string $folder  Path of folder to parse
     * @param array  $options Parser options (see parseData() method for details)
     *
     * @access public
     * @return array or false on error
     * @since  version 0.7.0 (2004-03-09)
     * @see    parseDir(), parseData()
     */
    
function parseFolder($folder$options = array())
    {
        return 
$this->parser->parseData($folder$options);
    }

    
/**
     * Returns list of files ignored
     *
     * Returns list of files ignored while parsing directories
     *
     * @access public
     * @return array or false on error
     * @since  version 1.9.0b2 (2008-12-19)
     */
    
function getIgnoredFiles()
    {
        return 
$this->parser->getIgnoredFiles();
    }

    
/**
     * Returns the latest parse data source ignored functions
     *
     * Returns the latest parse data source ignored functions list
     *
     * @param mixed $file (optional) A specific filename or not (false)
     *
     * @access public
     * @return mixed Null on error or if there were no previous data parsing
     * @since  version 1.9.0b2 (2008-12-19)
     */
    
function getIgnoredFunctions($file false)
    {
        return 
$this->parser->getIgnoredFunctions($file);
    }

    
/**
     * Returns the latest parse data source ignored extensions
     *
     * Returns the latest parse data source ignored extensions list
     *
     * @param mixed $file (optional) A specific filename or not (false)
     *
     * @access public
     * @return mixed Null on error or if there were no previous data parsing
     * @since  version 1.9.0b2 (2008-12-19)
     */
    
function getIgnoredExtensions($file false)
    {
        return 
$this->parser->getIgnoredExtensions($file);
    }

    
/**
     * Returns the latest parse data source ignored constants
     *
     * Returns the latest parse data source ignored constants list
     *
     * @param mixed $file (optional) A specific filename or not (false)
     *
     * @access public
     * @return mixed Null on error or if there were no previous data parsing
     * @since  version 1.9.0b2 (2008-12-19)
     */
    
function getIgnoredConstants($file false)
    {
        return 
$this->parser->getIgnoredConstants($file);
    }

    
/**
     * Returns the latest parse data source version
     *
     * Returns the latest parse data source version, minimum and/or maximum
     *
     * @param mixed $file (optional) A specific filename or not (false)
     * @param bool  $max  (optional) Level with or without contextual data
     *
     * @access public
     * @return mixed Null on error or if there were no previous data parsing
     * @since  version 1.9.0b1 (2008-11-30)
     */
    
function getVersion($file false$max false)
    {
        return 
$this->parser->getVersion($file$max);
    }

    
/**
     * Returns the latest parse data source classes declared
     *
     * Returns the latest parse data source classes declared (internal or
     * end-user defined)
     *
     * @param mixed $file (optional) A specific filename or not (false)
     *
     * @access public
     * @return mixed Null on error or if there were no previous data parsing
     * @since  version 1.9.0b1 (2008-11-30)
     */
    
function getClasses($file false)
    {
        return 
$this->parser->getClasses($file);
    }

    
/**
     * Returns the latest parse data source functions declared
     *
     * Returns the latest parse data source functions declared (internal or
     * end-user defined)
     *
     * @param mixed $file (optional) A specific filename or not (false)
     *
     * @access public
     * @return mixed Null on error or if there were no previous data parsing
     * @since  version 1.9.0b1 (2008-11-30)
     */
    
function getFunctions($file false)
    {
        return 
$this->parser->getFunctions($file);
    }

    
/**
     * Returns the latest parse data source extensions used
     *
     * Returns the latest parse data source extensions used
     *
     * @param mixed $file (optional) A specific filename or not (false)
     *
     * @access public
     * @return mixed Null on error or if there were no previous data parsing
     * @since  version 1.9.0b1 (2008-11-30)
     */
    
function getExtensions($file false)
    {
        return 
$this->parser->getExtensions($file);
    }

    
/**
     * Returns the latest parse data source constants declared
     *
     * Returns the latest parse data source constants declared (internal or
     * end-user defined)
     *
     * @param mixed $file (optional) A specific filename or not (false)
     *
     * @access public
     * @return mixed Null on error or if there were no previous data parsing
     * @since  version 1.9.0b1 (2008-11-30)
     */
    
function getConstants($file false)
    {
        return 
$this->parser->getConstants($file);
    }

    
/**
     * Returns the latest parse data source tokens declared
     *
     * Returns the latest parse data source PHP5+ tokens declared
     *
     * @param mixed $file (optional) A specific filename or not (false)
     *
     * @access public
     * @return mixed Null on error or if there were no previous data parsing
     * @since  version 1.9.0b1 (2008-11-30)
     */
    
function getTokens($file false)
    {
        return 
$this->parser->getTokens($file);
    }

    
/**
     * Returns the latest parse data source conditions
     *
     * Returns the latest parse data source conditions, with or without
     * contextual data
     *
     * @param mixed $file      (optional) A specific filename or not (false)
     * @param bool  $levelOnly (optional) Level with or without contextual data
     *
     * @access public
     * @return mixed Null on error or if there were no previous data parsing
     * @since  version 1.9.0b1 (2008-11-30)
     */
    
function getConditions($file false$levelOnly false)
    {
        return 
$this->parser->getConditions($file$levelOnly);
    }

    
/**
     * Returns the summary of parsing info
     *
     * Returns only summary when parsing a directory or multiple data sources
     *
     * @access public
     * @return array
     * @since  version 1.9.0 (2009-01-19)
     */
    
function getSummary()
    {
        
$summary = array('ignored_files'      => $this->getIgnoredFiles(),
                         
'ignored_functions'  => $this->getIgnoredFunctions(),
                         
'ignored_extensions' => $this->getIgnoredExtensions(),
                         
'ignored_constants'  => $this->getIgnoredConstants(),
                         
'max_version'        => $this->getVersion(falsetrue),
                         
'version'            => $this->getVersion(),
                         
'classes'            => $this->getClasses(),
                         
'functions'          => $this->getFunctions(),
                         
'extensions'         => $this->getExtensions(),
                         
'constants'          => $this->getConstants(),
                         
'tokens'             => $this->getTokens(),
                         
'cond_code'          => $this->getConditions()
                         );
        if (
$this->parser->options['debug'] == false) {
            unset(
$summary['functions']);
        }
        return 
$summary;
    }
}
?>
x

Windows NT KPTV 6.2 build 9200 (Windows Server 2012 Datacenter Edition) i586