commit 6b169b17b167e4c4be1157d84a2bb784fe5c8a93 Author: Filip Halaxa <filip.halaxa@elnino.cz> Date: Tue Oct 6 18:02:03 2015 +0200 init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9fd1dab --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.idea +/vendor/ diff --git a/composer b/composer new file mode 100755 index 0000000..96fa2df Binary files /dev/null and b/composer differ diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..f17f2cc --- /dev/null +++ b/composer.json @@ -0,0 +1,20 @@ +{ + "name": "halaxa/json-iterator", + "description": "Json parser consuming a stream of json data with easy, iterable api.", + "require": { + "php": ">=5.6", + "ext-json": "*" + }, + "require-dev": { + "phpunit/phpunit": "*" + }, + "authors": [ + { + "name": "Filip Halaxa", + "email": "filip@halaxa.cz" + } + ], + "autoload" : { + "psr-4": {"JsonIterator\\": "src/"} + } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..a4f68d9 --- /dev/null +++ b/composer.lock @@ -0,0 +1,1398 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "87ad7a45366e88da867e9e579fb201ff", + "packages": [], + "packages-dev": [ + { + "name": "doctrine/instantiator", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", + "shasum": "" + }, + "require": { + "php": ">=5.3,<8.0-DEV" + }, + "require-dev": { + "athletic/athletic": "~0.1.8", + "ext-pdo": "*", + "ext-phar": "*", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "~2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://github.com/doctrine/instantiator", + "keywords": [ + "constructor", + "instantiate" + ], + "time": "2015-06-14T21:17:01+00:00" + }, + { + "name": "myclabs/deep-copy", + "version": "1.7.0", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", + "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "doctrine/collections": "^1.0", + "doctrine/common": "^2.6", + "phpunit/phpunit": "^4.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + }, + "files": [ + "src/DeepCopy/deep_copy.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "time": "2017-10-19T19:58:43+00:00" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "time": "2017-09-11T18:02:19+00:00" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "4.3.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "94fd0001232e47129dd3504189fa1c7225010d08" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94fd0001232e47129dd3504189fa1c7225010d08", + "reference": "94fd0001232e47129dd3504189fa1c7225010d08", + "shasum": "" + }, + "require": { + "php": "^7.0", + "phpdocumentor/reflection-common": "^1.0.0", + "phpdocumentor/type-resolver": "^0.4.0", + "webmozart/assert": "^1.0" + }, + "require-dev": { + "doctrine/instantiator": "~1.0.5", + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^6.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "time": "2017-11-30T07:14:17+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "0.4.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", + "shasum": "" + }, + "require": { + "php": "^5.5 || ^7.0", + "phpdocumentor/reflection-common": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^5.2||^4.8.24" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "time": "2017-07-14T14:27:02+00:00" + }, + { + "name": "phpspec/prophecy", + "version": "1.8.0", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4ba436b55987b4bf311cb7c6ba82aa528aac0a06", + "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": "^5.3|^7.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", + "sebastian/comparator": "^1.1|^2.0|^3.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0" + }, + "require-dev": { + "phpspec/phpspec": "^2.5|^3.2", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.8.x-dev" + } + }, + "autoload": { + "psr-0": { + "Prophecy\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", + "keywords": [ + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" + ], + "time": "2018-08-05T17:53:17+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "4.0.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ef7b2f56815df854e66ceaee8ebe9393ae36a40d", + "reference": "ef7b2f56815df854e66ceaee8ebe9393ae36a40d", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-xmlwriter": "*", + "php": "^5.6 || ^7.0", + "phpunit/php-file-iterator": "^1.3", + "phpunit/php-text-template": "^1.2", + "phpunit/php-token-stream": "^1.4.2 || ^2.0", + "sebastian/code-unit-reverse-lookup": "^1.0", + "sebastian/environment": "^1.3.2 || ^2.0", + "sebastian/version": "^1.0 || ^2.0" + }, + "require-dev": { + "ext-xdebug": "^2.1.4", + "phpunit/phpunit": "^5.7" + }, + "suggest": { + "ext-xdebug": "^2.5.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "time": "2017-04-02T07:44:40+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "1.4.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "time": "2017-11-27T13:52:08+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "time": "2015-06-21T13:50:34+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "1.0.9", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "time": "2017-02-26T11:10:40+00:00" + }, + { + "name": "phpunit/php-token-stream", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "791198a2c6254db10131eecfe8c06670700904db" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/791198a2c6254db10131eecfe8c06670700904db", + "reference": "791198a2c6254db10131eecfe8c06670700904db", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.2.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "time": "2017-11-27T05:48:46+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "5.5.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "3e6e88e56c912133de6e99b87728cca7ed70c5f5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3e6e88e56c912133de6e99b87728cca7ed70c5f5", + "reference": "3e6e88e56c912133de6e99b87728cca7ed70c5f5", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-json": "*", + "ext-pcre": "*", + "ext-reflection": "*", + "ext-spl": "*", + "myclabs/deep-copy": "~1.3", + "php": "^5.6 || ^7.0", + "phpspec/prophecy": "^1.3.1", + "phpunit/php-code-coverage": "^4.0.1", + "phpunit/php-file-iterator": "~1.4", + "phpunit/php-text-template": "~1.2", + "phpunit/php-timer": "^1.0.6", + "phpunit/phpunit-mock-objects": "^3.2", + "sebastian/comparator": "~1.1", + "sebastian/diff": "~1.2", + "sebastian/environment": "^1.3 || ^2.0", + "sebastian/exporter": "~1.2", + "sebastian/global-state": "~1.0", + "sebastian/object-enumerator": "~1.0", + "sebastian/resource-operations": "~1.0", + "sebastian/version": "~1.0|~2.0", + "symfony/yaml": "~2.1|~3.0" + }, + "conflict": { + "phpdocumentor/reflection-docblock": "3.0.2" + }, + "suggest": { + "phpunit/php-invoker": "~1.1" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.5.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "time": "2016-08-26T07:11:44+00:00" + }, + { + "name": "phpunit/phpunit-mock-objects", + "version": "3.4.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", + "reference": "a23b761686d50a560cc56233b9ecf49597cc9118" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/a23b761686d50a560cc56233b9ecf49597cc9118", + "reference": "a23b761686d50a560cc56233b9ecf49597cc9118", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": "^5.6 || ^7.0", + "phpunit/php-text-template": "^1.2", + "sebastian/exporter": "^1.2 || ^2.0" + }, + "conflict": { + "phpunit/phpunit": "<5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.4" + }, + "suggest": { + "ext-soap": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Mock Object library for PHPUnit", + "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", + "keywords": [ + "mock", + "xunit" + ], + "time": "2017-06-30T09:13:00+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7 || ^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "time": "2017-03-04T06:30:41+00:00" + }, + { + "name": "sebastian/comparator", + "version": "1.2.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "sebastian/diff": "~1.2", + "sebastian/exporter": "~1.2 || ~2.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "http://www.github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "time": "2017-01-29T09:50:25+00:00" + }, + { + "name": "sebastian/diff", + "version": "1.4.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff" + ], + "time": "2017-05-22T07:24:03+00:00" + }, + { + "name": "sebastian/environment", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5795ffe5dc5b02460c3e34222fee8cbe245d8fac", + "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "time": "2016-11-26T07:53:53+00:00" + }, + { + "name": "sebastian/exporter", + "version": "1.2.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4", + "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "sebastian/recursion-context": "~1.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "time": "2016-06-17T09:04:28+00:00" + }, + { + "name": "sebastian/global-state", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "time": "2015-10-12T03:26:01+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "d4ca2fb70344987502567bc50081c03e6192fb26" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/d4ca2fb70344987502567bc50081c03e6192fb26", + "reference": "d4ca2fb70344987502567bc50081c03e6192fb26", + "shasum": "" + }, + "require": { + "php": ">=5.6", + "sebastian/recursion-context": "~1.0" + }, + "require-dev": { + "phpunit/phpunit": "~5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "time": "2016-01-28T13:25:10+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/b19cc3298482a335a95f3016d2f8a6950f0fbcd7", + "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "time": "2016-10-03T07:41:43+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "shasum": "" + }, + "require": { + "php": ">=5.6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "time": "2015-07-28T20:34:47+00:00" + }, + { + "name": "sebastian/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "time": "2016-10-03T07:35:21+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.9.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "e3d826245268269cd66f8326bd8bc066687b4a19" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19", + "reference": "e3d826245268269cd66f8326bd8bc066687b4a19", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.9-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + }, + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "time": "2018-08-06T14:22:27+00:00" + }, + { + "name": "symfony/yaml", + "version": "v3.4.15", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "c2f4812ead9f847cb69e90917ca7502e6892d6b8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/c2f4812ead9f847cb69e90917ca7502e6892d6b8", + "reference": "c2f4812ead9f847cb69e90917ca7502e6892d6b8", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/polyfill-ctype": "~1.8" + }, + "conflict": { + "symfony/console": "<3.4" + }, + "require-dev": { + "symfony/console": "~3.4|~4.0" + }, + "suggest": { + "symfony/console": "For validating YAML files using the lint command" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Yaml Component", + "homepage": "https://symfony.com", + "time": "2018-08-10T07:34:36+00:00" + }, + { + "name": "webmozart/assert", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/webmozart/assert.git", + "reference": "0df1908962e7a3071564e857d86874dad1ef204a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/assert/zipball/0df1908962e7a3071564e857d86874dad1ef204a", + "reference": "0df1908962e7a3071564e857d86874dad1ef204a", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "time": "2018-01-29T19:49:41+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [] +} diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..9e492cb --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,7 @@ +<phpunit bootstrap="./test/bootstrap.php"> + <testsuites> + <testsuite name="main"> + <directory>./test/</directory> + </testsuite> + </testsuites> +</phpunit> diff --git a/src/Exception/InvalidArgumentException.php b/src/Exception/InvalidArgumentException.php new file mode 100644 index 0000000..1025c5a --- /dev/null +++ b/src/Exception/InvalidArgumentException.php @@ -0,0 +1,8 @@ +<?php + +namespace JsonIterator\Exception; + +class InvalidArgumentException extends \InvalidArgumentException +{ + +} diff --git a/src/Exception/PathNotFoundException.php b/src/Exception/PathNotFoundException.php new file mode 100644 index 0000000..e17f63a --- /dev/null +++ b/src/Exception/PathNotFoundException.php @@ -0,0 +1,8 @@ +<?php + +namespace JsonIterator\Exception; + +class PathNotFoundException extends \RuntimeException +{ + +} diff --git a/src/Exception/SyntaxError.php b/src/Exception/SyntaxError.php new file mode 100644 index 0000000..56426df --- /dev/null +++ b/src/Exception/SyntaxError.php @@ -0,0 +1,12 @@ +<?php + +namespace JsonIterator\Exception; + +class SyntaxError extends \RuntimeException +{ + public function __construct($message = "", $position) + { + parent::__construct($message." At position $position."); + } + +} diff --git a/src/JsonIterator.php b/src/JsonIterator.php new file mode 100644 index 0000000..c2204bd --- /dev/null +++ b/src/JsonIterator.php @@ -0,0 +1,63 @@ +<?php + +namespace JsonIterator; + +use IteratorAggregate; +use JsonIterator\Exception\InvalidArgumentException; + +class JsonIterator implements IteratorAggregate +{ + /** + * @var resource + */ + private $stream; + + /** + * @var string + */ + private $jsonPointer; + + public function __construct($stream, $jsonPointer = '') + { + if ( ! is_resource($stream) || get_resource_type($stream) !== 'stream') { + throw new InvalidArgumentException("Argument \$stream must be a valid stream resource."); + } + $this->stream = $stream; + $this->jsonPointer = $jsonPointer; + } + + /** + * @param $string + * @param string $jsonPointer + * @return self + */ + public static function fromString($string, $jsonPointer = '') + { + return new static(fopen("data://text/plain,$string", 'r'), $jsonPointer); + } + + /** + * @param $string + * @param string $jsonPointer + * @return self + */ + public static function fromFile($file, $jsonPointer = '') + { + return new static(fopen($file, 'r'), $jsonPointer); + } + + /** + * @param $string + * @param string $jsonPointer + * @return self + */ + public static function fromStream($stream, $jsonPointer = '') + { + return new static($stream, $jsonPointer); + } + + public function getIterator() + { + return new Parser(new Lexer($this->stream), $this->jsonPointer); + } +} diff --git a/src/Lexer.php b/src/Lexer.php new file mode 100644 index 0000000..60d7b2a --- /dev/null +++ b/src/Lexer.php @@ -0,0 +1,87 @@ +<?php + +namespace JsonIterator; + +class Lexer implements \IteratorAggregate +{ + /** @var resource */ + private $stream; + + private $position = 0; + + /** + * @param resource $stream + */ + public function __construct($stream) + { + if ( ! is_resource($stream)) { + throw new Exception\InvalidArgumentException('Parameter $stream must be valid resource.'); + } + $this->stream = $stream; + } + + /** + * @return \Generator + */ + public function getIterator() + { + $inString = false; + $tokenBuffer = ''; + $previousByte = null; + + ${' '} = 0; + ${"\n"} = 0; + ${"\r"} = 0; + ${"\t"} = 0; + ${'{'} = 1; + ${'}'} = 1; + ${'['} = 1; + ${']'} = 1; + ${':'} = 1; + ${','} = 1; + + while ('' !== ($bytes = fread($this->stream, 1024 * 8))) { + $bytesLength = strlen($bytes); + for ($i = 0; $i < $bytesLength; ++$i) { + $byte = $bytes[$i]; + ++$this->position; + + if ($inString) { + if ($byte === '"' && $previousByte !== '\\') { + $inString = false; + } else { + $previousByte = $byte; + } + $tokenBuffer .= $byte; + continue; + } + + if (isset($$byte)) { + if ($tokenBuffer !== '') { + yield $tokenBuffer; + $tokenBuffer = ''; + } + if ($$byte) { // is not whitespace + yield $byte; + } + } else { + if ($byte === '"') { + $inString = true; + } + $tokenBuffer .= $byte; + } + } + } + if ($tokenBuffer !== '') { + yield $tokenBuffer; + } + } + + /** + * @return int + */ + public function getPosition() + { + return $this->position; + } +} diff --git a/src/Parser.php b/src/Parser.php new file mode 100644 index 0000000..f8eb6ae --- /dev/null +++ b/src/Parser.php @@ -0,0 +1,217 @@ +<?php + +namespace JsonIterator; + +use JsonIterator\Exception\InvalidArgumentException; +use JsonIterator\Exception\PathNotFoundException; +use JsonIterator\Exception\SyntaxError; + +class Parser implements \IteratorAggregate +{ + const SCALAR_CONST = 1; + const SCALAR_STRING = 2; + const OBJECT_START = 4; + const OBJECT_END = 8; + const ARRAY_START = 16; + const ARRAY_END = 32; + const COMMA = 64; + const COLON = 128; + + const AFTER_ARRAY_START = self::ANY_VALUE | self::ARRAY_END; + const AFTER_OBJECT_START = self::SCALAR_STRING | self::OBJECT_END; + const AFTER_ARRAY_VALUE = self::COMMA | self::ARRAY_END; + const AFTER_OBJECT_VALUE = self::COMMA | self::OBJECT_END; + const ANY_VALUE = self::OBJECT_START | self::ARRAY_START | self::SCALAR_CONST | self::SCALAR_STRING; + + private $type = [ + 'n' => self::SCALAR_CONST, + 'N' => self::SCALAR_CONST, + 't' => self::SCALAR_CONST, + 'T' => self::SCALAR_CONST, + 'f' => self::SCALAR_CONST, + 'F' => self::SCALAR_CONST, + '+' => self::SCALAR_CONST, + '-' => self::SCALAR_CONST, + '0' => self::SCALAR_CONST, + '1' => self::SCALAR_CONST, + '2' => self::SCALAR_CONST, + '3' => self::SCALAR_CONST, + '4' => self::SCALAR_CONST, + '5' => self::SCALAR_CONST, + '6' => self::SCALAR_CONST, + '7' => self::SCALAR_CONST, + '8' => self::SCALAR_CONST, + '9' => self::SCALAR_CONST, + '"' => self::SCALAR_STRING, + '{' => self::OBJECT_START, + '}' => self::OBJECT_END, + '[' => self::ARRAY_START, + ']' => self::ARRAY_END, + ',' => self::COMMA, + ':' => self::COLON, + ]; + + /** @var Lexer */ + private $lexer; + + /** @var string */ + private $token; + + /** @var string */ + private $jsonPointerPath; + + /** @var string */ + private $jsonPointer; + + /** + * @param \Traversable $lexer + * @param string $jsonPointer Follows json pointer RFC https://tools.ietf.org/html/rfc6901 + */ + public function __construct(\Traversable $lexer, $jsonPointer = '') + { + if (0 === preg_match('_^(/(([^/~])|(~[01]))*)*$_', $jsonPointer, $matches)) { + throw new InvalidArgumentException("Given value '$jsonPointer' of \$jsonPointer is not valid JSON Pointer"); + } + + $this->lexer = $lexer; + $this->jsonPointer = $jsonPointer; + $this->jsonPointerPath = array_slice(array_map(function ($jsonPointerPart){ + $jsonPointerPart = str_replace('~0', '~', str_replace('~1', '/', $jsonPointerPart)); + return is_numeric($jsonPointerPart) ? (int) $jsonPointerPart : $jsonPointerPart; + }, explode('/', $jsonPointer)), 1); + } + + /** + * @param \Generator $lexer + * @return \Generator + */ + public function getIterator() + { + // todo Allow to call getIterator only once per instance + $iteratorLevel = count($this->jsonPointerPath); + $iteratorStruct = null; + $currentPath = []; + $pathFound = false; + $currentLevel = -1; + $stack = [$currentLevel => null]; + $jsonBuffer = ''; + $key = null; + $previousToken = null; + $inArray = false; + $inObject = false; + $expectedType = self::OBJECT_START | self::ARRAY_START; + + foreach ($this->lexer as $token) { + $this->token = $token; + $firstChar = $token[0]; + if ( ! isset($this->type[$firstChar]) || ! ($this->type[$firstChar] & $expectedType)) { + $this->error("Unexpected symbol"); + } + if ($currentLevel > $iteratorLevel || ($currentLevel === $iteratorLevel && $expectedType & self::ANY_VALUE)) { + $jsonBuffer .= $token; + } + if ($currentLevel < $iteratorLevel && $inArray && $expectedType & self::ANY_VALUE) { + $currentPath[$currentLevel] = isset($currentPath[$currentLevel]) ? (1+$currentPath[$currentLevel]) : 0; + } + switch ($firstChar) { + case '"': + if ($inObject && ($previousToken === ',' || $previousToken === '{')) { + $expectedType = self::COLON; + $previousToken = null; + if ($currentLevel === $iteratorLevel) { + $key = $token; + } elseif ($currentLevel < $iteratorLevel) { + $currentPath[$currentLevel] = json_decode($token); + } + break; + } else { + goto expectedTypeAfterValue; + } + case ',': + if ($inObject) { + $expectedType = self::SCALAR_STRING; + } else { + $expectedType = self::ANY_VALUE; + } + $previousToken = ','; + break; + case ':': + $expectedType = self::ANY_VALUE; + break; + case '{': + ++$currentLevel; + if ($currentLevel === $iteratorLevel) { + $iteratorStruct = $token; + } + $stack[$currentLevel] = $token; + $inArray = !$inObject = true; + $expectedType = self::AFTER_OBJECT_START; + $previousToken = '{'; + break; + case '[': + ++$currentLevel; + if ($currentLevel === $iteratorLevel) { + $iteratorStruct = $token; + } + $stack[$currentLevel] = $token; + $inArray = !$inObject = false; + $expectedType = self::AFTER_ARRAY_START; + break; + case '}': + case ']': + --$currentLevel; + $inArray = !$inObject = $stack[$currentLevel] === '{'; + default: + expectedTypeAfterValue: + if ($inArray) { + $expectedType = self::AFTER_ARRAY_VALUE; + } else { + $expectedType = self::AFTER_OBJECT_VALUE; + } + } + if ( ! $pathFound && $currentPath == $this->jsonPointerPath) { + $pathFound = true; + } + if ($currentLevel === $iteratorLevel && $jsonBuffer !== '') { + if ($currentPath == $this->jsonPointerPath) { + $value = json_decode($jsonBuffer, true); + if ($iteratorStruct === '[') { + yield $value; + } else { + yield json_decode($key) => $value; + } + } + $jsonBuffer = ''; + } + } + + if ($this->token === null) { + $this->error('Cannot iterate empty JSON'); + } + + if ( ! $pathFound) { + throw new PathNotFoundException("Path '{$this->jsonPointer}' was not found in json stream."); + } + } + + /** + * @return array + */ + public function getJsonPointerPath() + { + return $this->jsonPointerPath; + } + + /** + * @return string + */ + public function getJsonPointer() + { + return $this->jsonPointer; + } + + private function error($msg) + { + throw new SyntaxError($msg." '".$this->token."'", $this->lexer->getPosition()); + } +} diff --git a/test/JsonStreamReaderTest/JsonIteratorTest.json b/test/JsonStreamReaderTest/JsonIteratorTest.json new file mode 100644 index 0000000..b11a564 --- /dev/null +++ b/test/JsonStreamReaderTest/JsonIteratorTest.json @@ -0,0 +1 @@ +{"args": {"key":"value"}} diff --git a/test/JsonStreamReaderTest/JsonIteratorTest.php b/test/JsonStreamReaderTest/JsonIteratorTest.php new file mode 100644 index 0000000..e6d8ae0 --- /dev/null +++ b/test/JsonStreamReaderTest/JsonIteratorTest.php @@ -0,0 +1,26 @@ +<?php + +namespace JsonIteratorTest; + +use JsonIterator\JsonIterator; + +class JsonIteratorTest extends \PHPUnit_Framework_TestCase +{ + /** + * @dataProvider dataFactories + */ + public function testFactories($methodName, ...$args) + { + $iterator = call_user_func_array(JsonIterator::class."::$methodName", $args); + $this->assertSame(["key" => "value"], iterator_to_array($iterator)); + } + + public function dataFactories() + { + return [ + ['fromStream', fopen('data://text/plain,{"args": {"key":"value"}}', 'r'), '/args'], + ['fromString', '{"args": {"key":"value"}}', '/args'], + ['fromFile', __DIR__ . '/JsonIteratorTest.json', '/args'], + ]; + } +} diff --git a/test/JsonStreamReaderTest/LexerTest.php b/test/JsonStreamReaderTest/LexerTest.php new file mode 100644 index 0000000..9c35369 --- /dev/null +++ b/test/JsonStreamReaderTest/LexerTest.php @@ -0,0 +1,22 @@ +<?php + +namespace JsonIteratorTest; + +use JsonIterator\Lexer; +use JsonIterator\Exception; + +class LexerTest extends \PHPUnit_Framework_TestCase +{ + public function testGeneratesTokens() + { + $data = 'data://text/plain,{}[],:null,"string" false:true,1,100000,1.555{-56]"","\\""'; + $expected = ['{','}','[',']',',',':','null',',','"string"','false',':','true',',','1',',','100000',',','1.555','{','-56',']','""',',','"\\""']; + $this->assertEquals($expected, iterator_to_array(new Lexer(fopen($data, 'r')))); + } + + public function testThrowsIfNoResource() + { + $this->setExpectedException(Exception\InvalidArgumentException::class); + new Lexer(false); + } +} diff --git a/test/JsonStreamReaderTest/ParserTest.php b/test/JsonStreamReaderTest/ParserTest.php new file mode 100644 index 0000000..b901441 --- /dev/null +++ b/test/JsonStreamReaderTest/ParserTest.php @@ -0,0 +1,167 @@ +<?php + +namespace JsonIteratorTest; + +use JsonIterator\Exception\InvalidArgumentException; +use JsonIterator\Exception\PathNotFoundException; +use JsonIterator\Exception\SyntaxError; +use JsonIterator\Lexer; +use JsonIterator\Parser; + +class ParserTest extends \PHPUnit_Framework_TestCase +{ + /** + * @dataProvider dataSyntax + */ + public function testSyntax($pathSpec, $json, $expectedResult) + { + $result = iterator_to_array($this->createParser($json, $pathSpec)); + $this->assertEquals($expectedResult, $result); + } + + public function dataSyntax() + { + return [ + ['', '{}', []], + ['', '{"a": "b"}', ['a'=>'b']], + ['', '{"a":{"b":{"c":1}}}', ['a'=>['b'=>['c'=>1]]]], + ['', '[]', []], + ['', '[null,true,false,"a",0,1,42.5]', [null,true,false,"a",0,1,42.5]], + ['', '[{"c":1}]', [['c'=>1]]], + ['', '[{"c":1},"string",{"d":2},false]', [['c'=>1],"string",['d'=>2],false]], + ['', '[false,{"c":1},"string",{"d":2}]', [false,['c'=>1],"string",['d'=>2]]], + ['', '[{"c":1,"d":2}]', [['c'=>1,'d'=>2]]], + ['/', '{"":{"c":1,"d":2}}', ['c'=>1,'d'=>2]], + ['/~0', '{"~":{"c":1,"d":2}}', ['c'=>1,'d'=>2]], + ['/~1', '{"/":{"c":1,"d":2}}', ['c'=>1,'d'=>2]], + ['/path', '{"path":{"c":1,"d":2}}', ['c'=>1,'d'=>2]], + ['/path', '{"no":[null], "path":{"c":1,"d":2}}', ['c'=>1,'d'=>2]], + ['/0', '[{"c":1,"d":2}, [null]]', ['c'=>1,'d'=>2]], + ['/0/path', '[{"path":{"c":1,"d":2}}]', ['c'=>1,'d'=>2]], + ['/1/path', '[[null], {"path":{"c":1,"d":2}}]', ['c'=>1,'d'=>2]], + ['/path/0', '{"path":[{"c":1,"d":2}, [null]]}', ['c'=>1,'d'=>2]], + ['/path/1', '{"path":[null,{"c":1,"d":2}, [null]]}', ['c'=>1,'d'=>2]], + ['/path/to', '{"path":{"to":{"c":1,"d":2}}}', ['c'=>1,'d'=>2]], + ['/0/0', '[{"0":{"c":1,"d":2}}]', ['c'=>1,'d'=>2]], + ['/1/1', '[0,{"1":{"c":1,"d":2}}]', ['c'=>1,'d'=>2]], + ]; + } + + public function testThrowsOnNotFoundPathSpec() + { + $parser = $this->createParser('{}', '/not/found'); + $this->expectException(PathNotFoundException::class); + $this->expectExceptionMessage("Path '/not/found' was not found in json stream."); + iterator_to_array($parser); + } + + /** + * @dataProvider dataGetPathSpec + */ + public function testGetPathSpec($pathSpec, array $expectedPathSpec) + { + $parser = $this->createParser('{}', $pathSpec); + $this->assertEquals($expectedPathSpec, $parser->getJsonPointerPath()); + } + + public function dataGetPathSpec() + { + return [ + ['/', ['']], + ['////', ['', '', '', '']], + ['/apple', ['apple']], + ['/apple/pie', ['apple', 'pie']], + ['/0/1 ', [0, '1 ']], + ]; + } + + /** + * @dataProvider dataThrowsOnMalformedJsonPointer + */ + public function testThrowsOnMalformedJsonPointer($jsonPointer) + { + $this->expectException(InvalidArgumentException::class); + new Parser(new \ArrayObject(), $jsonPointer); + } + + public function dataThrowsOnMalformedJsonPointer() + { + return [ + ['apple'], + ['/apple/~'], + ['apple/pie'], + ['apple/pie/'], + [' /apple/pie/'], + ]; + } + + /** + * @dataProvider dataSyntaxError + */ + public function testSyntaxError($notIterableJson, $exception = SyntaxError::class) + { + $this->expectException($exception); + + iterator_to_array($this->createParser($notIterableJson)); + } + + public function dataSyntaxError() + { + return [ + ['[}'], + ['{]'], + ['null'], + ['true'], + ['false'], + ['0'], + ['100'], + ['"string"'], + ['}'], + [']'], + [','], + [':'], + [''], + ['[null null]'], + ['["string" "string"]'], + ['[,"string","string"]'], + ['["string",,"string"]'], + ['["string","string",]'], + ]; + } + + private function createParser($json, $jsonPointer = '') + { + return new Parser(new Lexer(fopen("data://text/plain,$json", 'r')), $jsonPointer); + } + + public function testPerformance() + { + $tmpJsonFileName = $this->createBigJsonFile(); + $tmpJson = fopen($tmpJsonFileName, 'r'); + $parser = new Parser(new Lexer($tmpJson)); + $start = microtime(true); + foreach ($parser as $item) { + + } + $time = microtime(true) - $start; + $filesizeMb = (filesize($tmpJsonFileName)/1024/1024); + var_dump(round($filesizeMb/$time, 2)); + @unlink($tmpJsonFileName); + } + + private function createBigJsonFile() + { + $tmpJson = tempnam(sys_get_temp_dir(), 'json_'); + $f = fopen($tmpJson, 'w'); + $separator = ''; + fputs($f, '['); + for ($i=0; $i<1000; $i++) { + fputs($f, $separator); + fputs($f, file_get_contents(__DIR__.'/twitter_example_'. ($i%2) .'.json')); + $separator = ",\n\n"; + } + fputs($f, ']'); + fclose($f); + return $tmpJson; + } +} diff --git a/test/JsonStreamReaderTest/twitter_example_0.json b/test/JsonStreamReaderTest/twitter_example_0.json new file mode 100644 index 0000000..55bb855 --- /dev/null +++ b/test/JsonStreamReaderTest/twitter_example_0.json @@ -0,0 +1,415 @@ +{ + "statuses": [ + { + "coordinates": null, + "favorited": false, + "truncated": false, + "created_at": "Mon Sep 24 03:35:21 +0000 2012", + "id_str": "250075927172759552", + "entities": { + "urls": [ + + ], + "hashtags": [ + { + "text": "freebandnames", + "indices": [ + 20, + 34 + ] + } + ], + "user_mentions": [ + + ] + }, + "in_reply_to_user_id_str": null, + "contributors": null, + "text": "Aggressive Ponytail #freebandnames", + "metadata": { + "iso_language_code": "en", + "result_type": "recent" + }, + "retweet_count": 0, + "in_reply_to_status_id_str": null, + "id": 250075927172759552, + "geo": null, + "retweeted": false, + "in_reply_to_user_id": null, + "place": null, + "user": { + "profile_sidebar_fill_color": "DDEEF6", + "profile_sidebar_border_color": "C0DEED", + "profile_background_tile": false, + "name": "Sean Cummings", + "profile_image_url": "http://a0.twimg.com/profile_images/2359746665/1v6zfgqo8g0d3mk7ii5s_normal.jpeg", + "created_at": "Mon Apr 26 06:01:55 +0000 2010", + "location": "LA, CA", + "follow_request_sent": null, + "profile_link_color": "0084B4", + "is_translator": false, + "id_str": "137238150", + "entities": { + "url": { + "urls": [ + { + "expanded_url": null, + "url": "", + "indices": [ + 0, + 0 + ] + } + ] + }, + "description": { + "urls": [ + + ] + } + }, + "default_profile": true, + "contributors_enabled": false, + "favourites_count": 0, + "url": null, + "profile_image_url_https": "https://si0.twimg.com/profile_images/2359746665/1v6zfgqo8g0d3mk7ii5s_normal.jpeg", + "utc_offset": -28800, + "id": 137238150, + "profile_use_background_image": true, + "listed_count": 2, + "profile_text_color": "333333", + "lang": "en", + "followers_count": 70, + "protected": false, + "notifications": null, + "profile_background_image_url_https": "https://si0.twimg.com/images/themes/theme1/bg.png", + "profile_background_color": "C0DEED", + "verified": false, + "geo_enabled": true, + "time_zone": "Pacific Time (US & Canada)", + "description": "Born 330 Live 310", + "default_profile_image": false, + "profile_background_image_url": "http://a0.twimg.com/images/themes/theme1/bg.png", + "statuses_count": 579, + "friends_count": 110, + "following": null, + "show_all_inline_media": false, + "screen_name": "sean_cummings" + }, + "in_reply_to_screen_name": null, + "source": "Twitter for Mac", + "in_reply_to_status_id": null + }, + { + "coordinates": null, + "favorited": false, + "truncated": false, + "created_at": "Fri Sep 21 23:40:54 +0000 2012", + "id_str": "249292149810667520", + "entities": { + "urls": [ + + ], + "hashtags": [ + { + "text": "FreeBandNames", + "indices": [ + 20, + 34 + ] + } + ], + "user_mentions": [ + + ] + }, + "in_reply_to_user_id_str": null, + "contributors": null, + "text": "Thee Namaste Nerdz. #FreeBandNames", + "metadata": { + "iso_language_code": "pl", + "result_type": "recent" + }, + "retweet_count": 0, + "in_reply_to_status_id_str": null, + "id": 249292149810667520, + "geo": null, + "retweeted": false, + "in_reply_to_user_id": null, + "place": null, + "user": { + "profile_sidebar_fill_color": "DDFFCC", + "profile_sidebar_border_color": "BDDCAD", + "profile_background_tile": true, + "name": "Chaz Martenstein", + "profile_image_url": "http://a0.twimg.com/profile_images/447958234/Lichtenstein_normal.jpg", + "created_at": "Tue Apr 07 19:05:07 +0000 2009", + "location": "Durham, NC", + "follow_request_sent": null, + "profile_link_color": "0084B4", + "is_translator": false, + "id_str": "29516238", + "entities": { + "url": { + "urls": [ + { + "expanded_url": null, + "url": "http://bullcityrecords.com/wnng/", + "indices": [ + 0, + 32 + ] + } + ] + }, + "description": { + "urls": [ + + ] + } + }, + "default_profile": false, + "contributors_enabled": false, + "favourites_count": 8, + "url": "http://bullcityrecords.com/wnng/", + "profile_image_url_https": "https://si0.twimg.com/profile_images/447958234/Lichtenstein_normal.jpg", + "utc_offset": -18000, + "id": 29516238, + "profile_use_background_image": true, + "listed_count": 118, + "profile_text_color": "333333", + "lang": "en", + "followers_count": 2052, + "protected": false, + "notifications": null, + "profile_background_image_url_https": "https://si0.twimg.com/profile_background_images/9423277/background_tile.bmp", + "profile_background_color": "9AE4E8", + "verified": false, + "geo_enabled": false, + "time_zone": "Eastern Time (US & Canada)", + "description": "You will come to Durham, North Carolina. I will sell you some records then, here in Durham, North Carolina. Fun will happen.", + "default_profile_image": false, + "profile_background_image_url": "http://a0.twimg.com/profile_background_images/9423277/background_tile.bmp", + "statuses_count": 7579, + "friends_count": 348, + "following": null, + "show_all_inline_media": true, + "screen_name": "bullcityrecords" + }, + "in_reply_to_screen_name": null, + "source": "web", + "in_reply_to_status_id": null + }, + { + "coordinates": null, + "favorited": false, + "truncated": false, + "created_at": "Fri Sep 21 23:30:20 +0000 2012", + "id_str": "249289491129438208", + "entities": { + "urls": [ + + ], + "hashtags": [ + { + "text": "freebandnames", + "indices": [ + 29, + 43 + ] + } + ], + "user_mentions": [ + + ] + }, + "in_reply_to_user_id_str": null, + "contributors": null, + "text": "Mexican Heaven, Mexican Hell #freebandnames", + "metadata": { + "iso_language_code": "en", + "result_type": "recent" + }, + "retweet_count": 0, + "in_reply_to_status_id_str": null, + "id": 249289491129438208, + "geo": null, + "retweeted": false, + "in_reply_to_user_id": null, + "place": null, + "user": { + "profile_sidebar_fill_color": "99CC33", + "profile_sidebar_border_color": "829D5E", + "profile_background_tile": false, + "name": "Thomas John Wakeman", + "profile_image_url": "http://a0.twimg.com/profile_images/2219333930/Froggystyle_normal.png", + "created_at": "Tue Sep 01 21:21:35 +0000 2009", + "location": "Kingston New York", + "follow_request_sent": null, + "profile_link_color": "D02B55", + "is_translator": false, + "id_str": "70789458", + "entities": { + "url": { + "urls": [ + { + "expanded_url": null, + "url": "", + "indices": [ + 0, + 0 + ] + } + ] + }, + "description": { + "urls": [ + + ] + } + }, + "default_profile": false, + "contributors_enabled": false, + "favourites_count": 19, + "url": null, + "profile_image_url_https": "https://si0.twimg.com/profile_images/2219333930/Froggystyle_normal.png", + "utc_offset": -18000, + "id": 70789458, + "profile_use_background_image": true, + "listed_count": 1, + "profile_text_color": "3E4415", + "lang": "en", + "followers_count": 63, + "protected": false, + "notifications": null, + "profile_background_image_url_https": "https://si0.twimg.com/images/themes/theme5/bg.gif", + "profile_background_color": "352726", + "verified": false, + "geo_enabled": false, + "time_zone": "Eastern Time (US & Canada)", + "description": "Science Fiction Writer, sort of. Likes Superheroes, Mole People, Alt. Timelines.", + "default_profile_image": false, + "profile_background_image_url": "http://a0.twimg.com/images/themes/theme5/bg.gif", + "statuses_count": 1048, + "friends_count": 63, + "following": null, + "show_all_inline_media": false, + "screen_name": "MonkiesFist" + }, + "in_reply_to_screen_name": null, + "source": "web", + "in_reply_to_status_id": null + }, + { + "coordinates": null, + "favorited": false, + "truncated": false, + "created_at": "Fri Sep 21 22:51:18 +0000 2012", + "id_str": "249279667666817024", + "entities": { + "urls": [ + + ], + "hashtags": [ + { + "text": "freebandnames", + "indices": [ + 20, + 34 + ] + } + ], + "user_mentions": [ + + ] + }, + "in_reply_to_user_id_str": null, + "contributors": null, + "text": "The Foolish Mortals #freebandnames", + "metadata": { + "iso_language_code": "en", + "result_type": "recent" + }, + "retweet_count": 0, + "in_reply_to_status_id_str": null, + "id": 249279667666817024, + "geo": null, + "retweeted": false, + "in_reply_to_user_id": null, + "place": null, + "user": { + "profile_sidebar_fill_color": "BFAC83", + "profile_sidebar_border_color": "615A44", + "profile_background_tile": true, + "name": "Marty Elmer", + "profile_image_url": "http://a0.twimg.com/profile_images/1629790393/shrinker_2000_trans_normal.png", + "created_at": "Mon May 04 00:05:00 +0000 2009", + "location": "Wisconsin, USA", + "follow_request_sent": null, + "profile_link_color": "3B2A26", + "is_translator": false, + "id_str": "37539828", + "entities": { + "url": { + "urls": [ + { + "expanded_url": null, + "url": "http://www.omnitarian.me", + "indices": [ + 0, + 24 + ] + } + ] + }, + "description": { + "urls": [ + + ] + } + }, + "default_profile": false, + "contributors_enabled": false, + "favourites_count": 647, + "url": "http://www.omnitarian.me", + "profile_image_url_https": "https://si0.twimg.com/profile_images/1629790393/shrinker_2000_trans_normal.png", + "utc_offset": -21600, + "id": 37539828, + "profile_use_background_image": true, + "listed_count": 52, + "profile_text_color": "000000", + "lang": "en", + "followers_count": 608, + "protected": false, + "notifications": null, + "profile_background_image_url_https": "https://si0.twimg.com/profile_background_images/106455659/rect6056-9.png", + "profile_background_color": "EEE3C4", + "verified": false, + "geo_enabled": false, + "time_zone": "Central Time (US & Canada)", + "description": "Cartoonist, Illustrator, and T-Shirt connoisseur", + "default_profile_image": false, + "profile_background_image_url": "http://a0.twimg.com/profile_background_images/106455659/rect6056-9.png", + "statuses_count": 3575, + "friends_count": 249, + "following": null, + "show_all_inline_media": true, + "screen_name": "Omnitarian" + }, + "in_reply_to_screen_name": null, + "source": "Twitter for iPhone", + "in_reply_to_status_id": null + } + ], + "search_metadata": { + "max_id": 250126199840518145, + "since_id": 24012619984051000, + "refresh_url": "?since_id=250126199840518145&q=%23freebandnames&result_type=mixed&include_entities=1", + "next_results": "?max_id=249279667666817023&q=%23freebandnames&count=4&include_entities=1&result_type=mixed", + "count": 4, + "completed_in": 0.035, + "since_id_str": "24012619984051000", + "query": "%23freebandnames", + "max_id_str": "250126199840518145" + } +} diff --git a/test/JsonStreamReaderTest/twitter_example_1.json b/test/JsonStreamReaderTest/twitter_example_1.json new file mode 100644 index 0000000..4ce345c --- /dev/null +++ b/test/JsonStreamReaderTest/twitter_example_1.json @@ -0,0 +1,145 @@ +{ + "text": "RT @PostGradProblem: In preparation for the NFL lockout, I will be spending twice as much time analyzing my fantasy baseball team during ...", + "truncated": true, + "in_reply_to_user_id": null, + "in_reply_to_status_id": null, + "favorited": false, + "source": "<a href=\"http://twitter.com/\" rel=\"nofollow\">Twitter for iPhone</a>", + "in_reply_to_screen_name": null, + "in_reply_to_status_id_str": null, + "id_str": "54691802283900928", + "entities": { + "user_mentions": [ + { + "indices": [ + 3, + 19 + ], + "screen_name": "PostGradProblem", + "id_str": "271572434", + "name": "PostGradProblems", + "id": 271572434 + } + ], + "urls": [ ], + "hashtags": [ ] + }, + "contributors": null, + "retweeted": false, + "in_reply_to_user_id_str": null, + "place": null, + "retweet_count": 4, + "created_at": "Sun Apr 03 23:48:36 +0000 2011", + "retweeted_status": { + "text": "In preparation for the NFL lockout, I will be spending twice as much time analyzing my fantasy baseball team during company time. #PGP", + "truncated": false, + "in_reply_to_user_id": null, + "in_reply_to_status_id": null, + "favorited": false, + "source": "<a href=\"http://www.hootsuite.com\" rel=\"nofollow\">HootSuite</a>", + "in_reply_to_screen_name": null, + "in_reply_to_status_id_str": null, + "id_str": "54640519019642881", + "entities": { + "user_mentions": [ ], + "urls": [ ], + "hashtags": [ + { + "text": "PGP", + "indices": [ + 130, + 134 + ] + } + ] + }, + "contributors": null, + "retweeted": false, + "in_reply_to_user_id_str": null, + "place": null, + "retweet_count": 4, + "created_at": "Sun Apr 03 20:24:49 +0000 2011", + "user": { + "notifications": null, + "profile_use_background_image": true, + "statuses_count": 31, + "profile_background_color": "C0DEED", + "followers_count": 3066, + "profile_image_url": "http://a2.twimg.com/profile_images/1285770264/PGP_normal.jpg", + "listed_count": 6, + "profile_background_image_url": "http://a3.twimg.com/a/1301071706/images/themes/theme1/bg.png", + "description": "", + "screen_name": "PostGradProblem", + "default_profile": true, + "verified": false, + "time_zone": null, + "profile_text_color": "333333", + "is_translator": false, + "profile_sidebar_fill_color": "DDEEF6", + "location": "", + "id_str": "271572434", + "default_profile_image": false, + "profile_background_tile": false, + "lang": "en", + "friends_count": 21, + "protected": false, + "favourites_count": 0, + "created_at": "Thu Mar 24 19:45:44 +0000 2011", + "profile_link_color": "0084B4", + "name": "PostGradProblems", + "show_all_inline_media": false, + "follow_request_sent": null, + "geo_enabled": false, + "profile_sidebar_border_color": "C0DEED", + "url": null, + "id": 271572434, + "contributors_enabled": false, + "following": null, + "utc_offset": null + }, + "id": 54640519019642880, + "coordinates": null, + "geo": null + }, + "user": { + "notifications": null, + "profile_use_background_image": true, + "statuses_count": 351, + "profile_background_color": "C0DEED", + "followers_count": 48, + "profile_image_url": "http://a1.twimg.com/profile_images/455128973/gCsVUnofNqqyd6tdOGevROvko1_500_normal.jpg", + "listed_count": 0, + "profile_background_image_url": "http://a3.twimg.com/a/1300479984/images/themes/theme1/bg.png", + "description": "watcha doin in my waters?", + "screen_name": "OldGREG85", + "default_profile": true, + "verified": false, + "time_zone": "Hawaii", + "profile_text_color": "333333", + "is_translator": false, + "profile_sidebar_fill_color": "DDEEF6", + "location": "Texas", + "id_str": "80177619", + "default_profile_image": false, + "profile_background_tile": false, + "lang": "en", + "friends_count": 81, + "protected": false, + "favourites_count": 0, + "created_at": "Tue Oct 06 01:13:17 +0000 2009", + "profile_link_color": "0084B4", + "name": "GG", + "show_all_inline_media": false, + "follow_request_sent": null, + "geo_enabled": false, + "profile_sidebar_border_color": "C0DEED", + "url": null, + "id": 80177619, + "contributors_enabled": false, + "following": null, + "utc_offset": -36000 + }, + "id": 54691802283900930, + "coordinates": null, + "geo": null +} diff --git a/test/bootstrap.php b/test/bootstrap.php new file mode 100644 index 0000000..0fe3af5 --- /dev/null +++ b/test/bootstrap.php @@ -0,0 +1,4 @@ +<?php + +require_once __DIR__ . '/../vendor/autoload.php'; +