fzaninotto/Streamer

Be more oo - in the documentation

Opened this issue · 1 comments

I don't think this kind of approach is oo:

new Stream(fopen('smiley.png', 'r'));

it would be better this way:

new FileStream('smiley.png');

I see now, that you have FileStream class. Why don't you use it in the documentation?

You can call the factory of FileStream and NetworkStream to get the Stream

require __DIR__.'/../vendor/autoload.php';

use Streamer\Stream,
    Streamer\FileStream,
    Streamer\NetworkStream;

$stream = new Stream(fopen('smiley.png', 'r'));
print_r($stream);

$fileStream = FileStream::create('smiley.png', 'r');
print_r($fileStream);

$networkStream = NetworkStream::create('tcp://www.google.com:80');
print_r($networkStream);