mirror of
https://github.com/php/php-src.git
synced 2024-09-21 09:57:23 +00:00
modify php_dump.php, .cvsignore ignores *.php
move include to the place where it is used
This commit is contained in:
parent
71e0c354ff
commit
09ee88f9bf
@ -61,6 +61,7 @@ class PEAR_test_mock_pearweb {
|
||||
return false;
|
||||
}
|
||||
if (!isset($this->_config['xmlrpc'][$method][serialize($params)])) {
|
||||
include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'php_dump.php.inc';
|
||||
$args = $params;
|
||||
switch (count($args)) {
|
||||
case 0:
|
||||
|
@ -69,7 +69,6 @@ if (!empty($home)) {
|
||||
}
|
||||
require_once "PEAR/Downloader.php";
|
||||
require_once 'PEAR/Installer.php';
|
||||
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'php_dump.php';
|
||||
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'download_test_classes.php.inc';
|
||||
|
||||
// no UI is needed for these tests
|
||||
|
57
pear/tests/php_dump.php.inc
Normal file
57
pear/tests/php_dump.php.inc
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
class PHP_Dump {
|
||||
var $_var;
|
||||
function PHP_Dump($var)
|
||||
{
|
||||
$this->_var = $var;
|
||||
}
|
||||
|
||||
function toPHP()
|
||||
{
|
||||
return $this->_toUnknown($this->_var);
|
||||
}
|
||||
|
||||
function _toUnknown($var, $indent = ' ')
|
||||
{
|
||||
switch (gettype($var)) {
|
||||
case 'array' :
|
||||
return $this->_toArray($var, $indent);
|
||||
case 'boolean' :
|
||||
return $this->_toBool($var, $indent);
|
||||
case 'double' :
|
||||
case 'integer' :
|
||||
return $this->_toNumber($var, $indent);
|
||||
case 'NULL' :
|
||||
return "{$indent}null";
|
||||
case 'string' :
|
||||
return $this->_toString($var, $indent);
|
||||
}
|
||||
}
|
||||
|
||||
function _toString($var, $indent)
|
||||
{
|
||||
return $indent . '"' . addslashes($var) . '"';
|
||||
}
|
||||
|
||||
function _toBool($var, $indent)
|
||||
{
|
||||
return $indent . ($var ? 'true' : 'false');
|
||||
}
|
||||
|
||||
function _toNumber($var, $indent)
|
||||
{
|
||||
return $indent . $var;
|
||||
}
|
||||
|
||||
function _toArray($var, $indent = ' ')
|
||||
{
|
||||
$ret = $indent . "array(\n";
|
||||
foreach ($var as $key => $value) {
|
||||
$ret .= $indent . ((is_int($key) || is_double($key)) ? $key : "'$key'") . " =>\n";
|
||||
$ret .= $this->_toUnknown($value, "$indent ") . ",\n";
|
||||
}
|
||||
$ret .= $indent . ')';
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
?>
|
Loading…
Reference in New Issue
Block a user