From 58f69fd7ac7cd3e4339a46e762c13a7cafbc5323 Mon Sep 17 00:00:00 2001 From: Simon Frings Date: Tue, 25 Jun 2024 10:54:50 +0200 Subject: [PATCH] Rename Decoder to TarDecoder to avoid ambiguities --- README.md | 4 ++-- examples/dump.php | 2 +- src/{Decoder.php => TarDecoder.php} | 2 +- ...tionalDecoderTest.php => FunctionalTarDecoderTest.php} | 8 ++++---- tests/{DecoderTest.php => TarDecoderTest.php} | 8 ++++---- 5 files changed, 12 insertions(+), 12 deletions(-) rename src/{Decoder.php => TarDecoder.php} (99%) rename tests/{FunctionalDecoderTest.php => FunctionalTarDecoderTest.php} (93%) rename tests/{DecoderTest.php => TarDecoderTest.php} (98%) diff --git a/README.md b/README.md index 4ba6dad..38f7174 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ processing one chunk at a time in memory without having to rely on disk I/O. ## Quickstart example Once [installed](#install), you can use the following code to pipe a readable -tar stream into the `Decoder` which emits "entry" events for each individual file: +tar stream into the `TarDecoder` which emits "entry" events for each individual file: ```php on('entry', function (array $header, React\Stream\ReadableStreamInterface $file) { echo 'File ' . $header['filename']; diff --git a/examples/dump.php b/examples/dump.php index ec992a3..0d7d330 100644 --- a/examples/dump.php +++ b/examples/dump.php @@ -7,7 +7,7 @@ $stream = new React\Stream\ReadableResourceStream(fopen($in, 'r')); -$decoder = new Clue\React\Tar\Decoder(); +$decoder = new Clue\React\Tar\TarDecoder(); $decoder->on('entry', function (array $header, React\Stream\ReadableStreamInterface $file) { static $i = 0; echo 'FILE #' . ++$i . PHP_EOL; diff --git a/src/Decoder.php b/src/TarDecoder.php similarity index 99% rename from src/Decoder.php rename to src/TarDecoder.php index 2ad8c7d..d944bd1 100644 --- a/src/Decoder.php +++ b/src/TarDecoder.php @@ -18,7 +18,7 @@ * @event error(Exception $e) * @event close() */ -class Decoder extends EventEmitter implements WritableStreamInterface +class TarDecoder extends EventEmitter implements WritableStreamInterface { private $buffer = ''; private $writable = true; diff --git a/tests/FunctionalDecoderTest.php b/tests/FunctionalTarDecoderTest.php similarity index 93% rename from tests/FunctionalDecoderTest.php rename to tests/FunctionalTarDecoderTest.php index 11c6e06..16c5061 100644 --- a/tests/FunctionalDecoderTest.php +++ b/tests/FunctionalTarDecoderTest.php @@ -2,20 +2,20 @@ namespace Clue\Tests\React\Tar; -use Clue\React\Tar\Decoder; +use Clue\React\Tar\TarDecoder; use React\EventLoop\Loop; use React\Stream\ReadableResourceStream; -class FunctionDecoderTest extends TestCase +class FunctionalTarDecoderTest extends TestCase { private $decoder; /** * @before */ - public function setUpDecoderAndLoop() + public function setUpTarDecoderAndLoop() { - $this->decoder = new Decoder(); + $this->decoder = new TarDecoder(); } /** diff --git a/tests/DecoderTest.php b/tests/TarDecoderTest.php similarity index 98% rename from tests/DecoderTest.php rename to tests/TarDecoderTest.php index 6b83112..3eb0623 100644 --- a/tests/DecoderTest.php +++ b/tests/TarDecoderTest.php @@ -2,20 +2,20 @@ namespace Clue\Tests\React\Tar; -use Clue\React\Tar\Decoder; +use Clue\React\Tar\TarDecoder; use React\Stream\ThroughStream; use React\Stream\ReadableStreamInterface; -class DecoderTest extends TestCase +class TarDecoderTest extends TestCase { private $decoder; /** * @before */ - public function setUpDecoder() + public function setUpTarDecoder() { - $this->decoder = new Decoder(); + $this->decoder = new TarDecoder(); } public function testWriteLessDataThanBufferSizeWillNotEmitAnyEvents()