From 4d473095769d9d232a3b95ad749fd6d8777f97b0 Mon Sep 17 00:00:00 2001 From: Filip Halaxa Date: Thu, 27 Jan 2022 20:22:36 +0100 Subject: [PATCH] /src/examples -> /examples --- CHANGELOG.md | 2 +- README.md | 4 ++-- {src/examples => examples}/guzzleHttp.php | 2 +- {src/examples => examples}/memLeak.php | 4 ++-- {src/examples => examples}/symfonyHttpClient.php | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) rename {src/examples => examples}/guzzleHttp.php (87%) rename {src/examples => examples}/memLeak.php (82%) rename {src/examples => examples}/symfonyHttpClient.php (91%) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea30067..8f3042c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -112,7 +112,7 @@ However **built-in decoders depend on it** so it must be present if you use them - Throws `UnexpectedEndSyntaxErrorException` on an unexpected end of JSON structure (thanks @gabimem) - Function `httpClientChunks()` is **deprecated** so that compatibility with Symfony HttpClient is not on the shoulders of JSON Machine maintainer. The code is simple and everyone can make their own -function and maintain it. The code was moved to [examples](src/examples/symfonyHttpClient.php). +function and maintain it. The code was moved to [examples](examples/symfonyHttpClient.php). - Function `objects()` is **deprecated**. The way `objects()` works is that it casts decoded arrays to objects. It brings some unnecessary overhead and risks on huge datasets. Alternative is to use `ExtJsonDecoder` which decodes items as objects by default (same as `json_decode`). diff --git a/README.md b/README.md index ccf6426..24bb0f0 100644 --- a/README.md +++ b/README.md @@ -361,13 +361,13 @@ popular http clients which support streaming responses: Guzzle uses its own streams, but they can be converted back to PHP streams by calling `\GuzzleHttp\Psr7\StreamWrapper::getResource()`. Pass the result of this function to `Items::fromStream` function, and you're set up. See working -[GuzzleHttp example](src/examples/guzzleHttp.php). +[GuzzleHttp example](examples/guzzleHttp.php). ### Symfony HttpClient A stream response of Symfony HttpClient works as iterator. And because JSON Machine is based on iterators, the integration with Symfony HttpClient is very simple. See -[HttpClient example](src/examples/symfonyHttpClient.php). +[HttpClient example](examples/symfonyHttpClient.php). diff --git a/src/examples/guzzleHttp.php b/examples/guzzleHttp.php similarity index 87% rename from src/examples/guzzleHttp.php rename to examples/guzzleHttp.php index 1ca9607..5a857ce 100644 --- a/src/examples/guzzleHttp.php +++ b/examples/guzzleHttp.php @@ -1,6 +1,6 @@ request('GET', 'https://httpbin.org/anything?key=value'); diff --git a/src/examples/memLeak.php b/examples/memLeak.php similarity index 82% rename from src/examples/memLeak.php rename to examples/memLeak.php index eb0fad2..06f1550 100644 --- a/src/examples/memLeak.php +++ b/examples/memLeak.php @@ -2,14 +2,14 @@ use JsonMachine\Items; -require_once __DIR__.'/../../vendor/autoload.php'; +require_once __DIR__ . '/../../vendor/autoload.php'; ini_set('memory_limit', 128 * 1024 * 1024); function dummy() { $i = 0; - $string = file_get_contents(__DIR__.'/../../test/performance/twitter_example_0.json'); + $string = file_get_contents(__DIR__ . '/../../test/performance/twitter_example_0.json'); $item = '['.str_repeat($string.',', 400).$string.']'; var_dump(strlen($item)); diff --git a/src/examples/symfonyHttpClient.php b/examples/symfonyHttpClient.php similarity index 91% rename from src/examples/symfonyHttpClient.php rename to examples/symfonyHttpClient.php index 3d0e2c1..3b21296 100644 --- a/src/examples/symfonyHttpClient.php +++ b/examples/symfonyHttpClient.php @@ -4,7 +4,7 @@ use JsonMachine\Items; use Symfony\Component\HttpClient\HttpClient; use Symfony\Contracts\HttpClient\ResponseStreamInterface; -require_once __DIR__.'/../../vendor/autoload.php'; +require_once __DIR__ . '/../../vendor/autoload.php'; function httpClientChunks(ResponseStreamInterface $responseStream) {