rchouinard/bencode — pull request #5 by stecman (2014-12-12 00:12:40+00:00)
Title: Allow decoding from a file handle

This changes the decoder to read from an interface (`Rych\Bencode\DataSource`) instead of directly from a string. A built-in DataSource implementation allows decoding the contents of a file handle:

```php
$file = fopen('path/to/file.bin', 'r');
$decoded = Bencode::decode(
new FileHandle($file)
);
```

When I wrote this back in April, it broke backwards compatibility by changing the method signature of `Bencode::decode` to require an instance of `DataSource`, but I've updated it for this PR to implicitly convert strings to `Rych\Bencode\DataSource\String` instead.