KnpLabs/packagist-api — pull request #4 by chillu (2013-08-05 09:09:34+00:00)
Title: Allow empty 'dist' in Result\Factory

While trying to retrieve packages through the `Api\Client->get()`, I've come across an error how the JSON is deserialized into a `Package` object. It makes a few too many assumptions on the JSON data, for example that it always contains a `dist` key with an array value. That's not the case on some projects returns from packagist.org, e.g. on custom SVN repos (Example: https://packagist.org/packages/simonwelsh/hasoneedit.json).

I've made the code in this part a bit more defensive. You could argue that packagist.org should return `"dist": []` instead, but I don't see any harm in making the Packagist API code deal with those variations either, right?

Tried to find out which elements of a package JSON definitions are options, but the [schema](http://getcomposer.org/doc/04-schema.md) is a bit hazy on this, so I've wrapped a couple of other elements in the same check.