diff --git a/.gitignore b/.gitignore index b44f495..e7e3652 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,8 @@ phpunit.xml composer.lock composer.phar vendor/ +cache.properties +build/JeffWelch +build/LICENSE +build/README.md +build/*.tgz diff --git a/README.md b/README.md index 2f2bb4d..94c5a93 100644 --- a/README.md +++ b/README.md @@ -13,10 +13,7 @@ Exporting: ```php null ) */ -echo new Exporter(new Exception); + +print new Exporter(new Exception); ``` @@ -37,10 +35,7 @@ Diffing: ```php null ) */ + $exporter = new Exporter(new Exception); -echo $exporter->diff(new Exception); +print $exporter->diff(new Exception); ``` @@ -69,47 +65,41 @@ Exporting simple types: ```php stdClass Object &0000000003a66dcc0000000025e723e2 ) */ + $obj = new stdClass(); $obj->self = $obj; -echo new Exporter($obj); +print new Exporter($obj); ``` Compact exports: ```php shortenedExport(); +print $exporter->shortenedExport(); // Array (...) $exporter = new Exporter(array(1,2,3,4,5)); -echo $exporter->shortenedExport(); +print $exporter->shortenedExport(); // stdClass Object () $exporter = new Exporter(new stdClass); -echo $exporter->shortenedExport(); +print $exporter->shortenedExport(); // Exception Object (...) $exporter = new Exporter(new Exception); -echo $exporter->shortenedExport(); +print $exporter->shortenedExport(); // this\nis\na\nsuper\nlong\nstring\nt...\nspace $exporter = new Exporter( @@ -195,7 +185,7 @@ of space LONG_STRING ); -echo $exporter->shortenedExport(); +print $exporter->shortenedExport(); ``` ## Requirements @@ -234,4 +224,4 @@ thanks goes to the following people for their contributions: ## License -PHP_Exporter is licensed under the [BSD 3-Clause license](LICENSE). \ No newline at end of file +PHP_Exporter is licensed under the [BSD 3-Clause license](LICENSE). diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..8da3da6 --- /dev/null +++ b/build.xml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/package.xml b/build/package.xml new file mode 100644 index 0000000..cf3bb6f --- /dev/null +++ b/build/package.xml @@ -0,0 +1,59 @@ + + + PHP_Exporter + pear.phpunit.de + A nifty utility for visualizing and diffing PHP variables. + A nifty utility for visualizing and diffing PHP variables. + + Jeff Welch + whatthejeff + whatthejeff@gmail.com + yes + + 2013-MM-DD + + 1.0.0 + 1.0.0 + + + stable + stable + + The BSD 3-Clause License + http://github.com/whatthejeff/php-exporter/tree + + + + + + + + + + + + + + + + + + + + + 5.3.3 + + + 1.9.4 + + + + + diff --git a/composer.json b/composer.json index 3a636cc..19c0800 100644 --- a/composer.json +++ b/composer.json @@ -33,11 +33,13 @@ "phpunit/phpunit": "3.7.*" }, "autoload": { - "psr-0": { "PHP_Exporter": "src/" } + "classmap": [ + "src/" + ] }, "extra": { "branch-alias": { "dev-master": "1.0.x-dev" } } -} \ No newline at end of file +} diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 142cbde..24da47c 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,24 +1,23 @@ - - - - ./tests/PHP_Exporter/ - - - - - ./src - - - \ No newline at end of file + bootstrap="src/autoload.php"> + + + ./tests + + + + + ./src + + ./src/autoload.php + + + + diff --git a/src/PHP_Exporter/ExporterContext.php b/src/Context.php similarity index 97% rename from src/PHP_Exporter/ExporterContext.php rename to src/Context.php index dbbecd9..2c76fd2 100644 --- a/src/PHP_Exporter/ExporterContext.php +++ b/src/Context.php @@ -41,7 +41,7 @@ * @link http://www.github.com/whatthejeff/php-exporter */ -namespace PHP_Exporter; +namespace JeffWelch\PHP\Exporter; /** * A context containing previously rendered arrays and objects when recursively @@ -53,7 +53,7 @@ namespace PHP_Exporter; * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License * @link http://www.github.com/whatthejeff/php-exporter */ -class ExporterContext { +class Context { /** * Previously seen arrays. * @@ -112,7 +112,7 @@ class ExporterContext { return $this->containsObject($value); } - throw new ExporterException('Only arrays and objects are supported'); + throw new Exception('Only arrays and objects are supported'); } /** diff --git a/src/PHP_Exporter/Diff.php b/src/Diff.php similarity index 99% rename from src/PHP_Exporter/Diff.php rename to src/Diff.php index 24a589b..fb5aca0 100644 --- a/src/PHP_Exporter/Diff.php +++ b/src/Diff.php @@ -42,7 +42,7 @@ * @link http://www.github.com/whatthejeff/php-exporter */ -namespace PHP_Exporter; +namespace JeffWelch\PHP\Exporter; /** * Diff implementation. diff --git a/src/PHP_Exporter/ExporterException.php b/src/Exception.php similarity index 96% rename from src/PHP_Exporter/ExporterException.php rename to src/Exception.php index a75c92b..60e1eec 100644 --- a/src/PHP_Exporter/ExporterException.php +++ b/src/Exception.php @@ -42,7 +42,7 @@ * @link http://www.github.com/whatthejeff/php-exporter */ -namespace PHP_Exporter; +namespace JeffWelch\PHP\Exporter; /** * Exception for PHP_Exporter runtime errors. @@ -53,6 +53,6 @@ namespace PHP_Exporter; * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License * @link http://www.github.com/whatthejeff/PHP_Exporter */ -class ExporterException extends \RuntimeException +class Exception extends \RuntimeException { } diff --git a/src/PHP_Exporter/Exporter.php b/src/Exporter.php similarity index 99% rename from src/PHP_Exporter/Exporter.php rename to src/Exporter.php index ff67ab5..ef647fa 100644 --- a/src/PHP_Exporter/Exporter.php +++ b/src/Exporter.php @@ -41,7 +41,7 @@ * @link http://www.github.com/whatthejeff/php-exporter */ -namespace PHP_Exporter; +namespace JeffWelch\PHP\Exporter; /** * A nifty utility for visualizing and diffing PHP data types. @@ -171,7 +171,7 @@ class Exporter $whitespace = str_repeat(' ', 4 * $indentation); if (!$processed) { - $processed = new ExporterContext; + $processed = new Context; } if (is_array($value)) { diff --git a/src/autoload.php b/src/autoload.php new file mode 100644 index 0000000..f778b90 --- /dev/null +++ b/src/autoload.php @@ -0,0 +1,22 @@ + '/Context.php', + 'jeffwelch\\php\\exporter\\diff' => '/Diff.php', + 'jeffwelch\\php\\exporter\\exception' => '/Exception.php', + 'jeffwelch\\php\\exporter\\exporter' => '/Exporter.php' + ); + } + $cn = strtolower($class); + if (isset($classes[$cn])) { + require __DIR__ . $classes[$cn]; + } + } +); +// @codeCoverageIgnoreEnd \ No newline at end of file diff --git a/tests/PHP_Exporter/DiffTest.php b/tests/DiffTest.php similarity index 98% rename from tests/PHP_Exporter/DiffTest.php rename to tests/DiffTest.php index e6bcecb..e9a44a5 100644 --- a/tests/PHP_Exporter/DiffTest.php +++ b/tests/DiffTest.php @@ -41,7 +41,7 @@ * @link http://www.github.com/whatthejeff/php-exporter */ -use PHP_Exporter\Diff; +namespace JeffWelch\PHP\Exporter; /** * @@ -52,7 +52,7 @@ use PHP_Exporter\Diff; * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License * @link http://www.github.com/whatthejeff/php-exporter */ -class DiffTest extends PHPUnit_Framework_TestCase +class DiffTest extends \PHPUnit_Framework_TestCase { const REMOVED = 2; const ADDED = 1; diff --git a/tests/PHP_Exporter/ExporterTest.php b/tests/ExporterTest.php similarity index 96% rename from tests/PHP_Exporter/ExporterTest.php rename to tests/ExporterTest.php index 43f7c5e..7726894 100644 --- a/tests/PHP_Exporter/ExporterTest.php +++ b/tests/ExporterTest.php @@ -41,7 +41,7 @@ * @link http://www.github.com/whatthejeff/php-exporter */ -use PHP_Exporter\Exporter; +namespace JeffWelch\PHP\Exporter; /** * @@ -52,7 +52,7 @@ use PHP_Exporter\Exporter; * @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License * @link http://www.github.com/whatthejeff/php-exporter */ -class ExporterTest extends PHPUnit_Framework_TestCase +class ExporterTest extends \PHPUnit_Framework_TestCase { /** * Removes spaces in front newlines @@ -67,10 +67,10 @@ class ExporterTest extends PHPUnit_Framework_TestCase public function exportProvider() { - $obj2 = new stdClass; + $obj2 = new \stdClass; $obj2->foo = 'bar'; - $obj = new stdClass; + $obj = new \stdClass; //@codingStandardsIgnoreStart $obj->null = NULL; //@codingStandardsIgnoreEnd @@ -139,7 +139,7 @@ long text' EOF ), - array(new stdClass, 'stdClass Object &%x ()'), + array(new \stdClass, 'stdClass Object &%x ()'), array($obj, <<foo = 'bar'; $array = array( @@ -271,7 +271,7 @@ EOF array('1', "'1'"), // \n\r and \r is converted to \n array("this\nis\na\nvery\nvery\nvery\nvery\nvery\nvery\rlong\n\rtext", "'this\\nis\\na\\nvery\\nvery\\nvery\\nvery...g\\ntext'"), - array(new stdClass, 'stdClass Object ()'), + array(new \stdClass, 'stdClass Object ()'), array($obj, 'stdClass Object (...)'), array(array(), 'Array ()'), array($array, 'Array (...)'),