nozavroni / csvelte

🕺🏻 CSV and Tabular Data library for PHP
http://phpcsv.com/
Other
6 stars 0 forks source link

Refactor IO\Stream to work with IO\Resource #124

Closed nozavroni closed 7 years ago

nozavroni commented 7 years ago

Now that I have a (more or less) functioning IO\Resource class, it's time to refactor IO\Stream to make use of it. I haven't quite figured out how this is going to go yet, but the general idea is that the interface for IO\Stream will stay largely the same. You still instantiate it exactly the same way and everything, but internally it will be using an IO\Resource in place of the usual stream resource object. The connection will lazy load by default and only connect when $sr->getResource() is called. If the end-user wants to make use of the IO\Resource class, they can instantiate a resource object and pass it to a new method on the stream class... it will likely be something like IO\Stream::open($resource)

nozavroni commented 7 years ago

Actually I think it probably makes more sense to accept a Resource class in the constructor and provide a Stream::open() method that accepts all the individual params...

nozavroni commented 7 years ago

Completed and tested...