Skip to content

Commit

Permalink
Merge pull request #22 from SimonFrings/decoder
Browse files Browse the repository at this point in the history
Rename Decoder to TarDecoder to avoid ambiguities
  • Loading branch information
clue authored Jul 4, 2024
2 parents eec8393 + 58f69fd commit 91d700e
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
<?php
Expand All @@ -33,7 +33,7 @@ require __DIR__ . '/vendor/autoload.php';

$stream = new React\Stream\ReadableResourceStream(fopen('archive.tar', 'r'));

$decoder = new Clue\React\Tar\Decoder();
$decoder = new Clue\React\Tar\TarDecoder();

$decoder->on('entry', function (array $header, React\Stream\ReadableStreamInterface $file) {
echo 'File ' . $header['filename'];
Expand Down
2 changes: 1 addition & 1 deletion examples/dump.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/Decoder.php → src/TarDecoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

/**
Expand Down
8 changes: 4 additions & 4 deletions tests/DecoderTest.php → tests/TarDecoderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 91d700e

Please sign in to comment.