fzaninotto / Streamer

Object-Oriented API for PHP streams

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Be more oo - in the documentation

opened this issue · 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?

commented

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);