Skip to content

Commit

Permalink
Package version sources can be null
Browse files Browse the repository at this point in the history
  • Loading branch information
soullivaneuh committed Jan 18, 2018
1 parent 566849a commit 8d9d0f8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions spec/Packagist/Api/Fixture/get_null_source.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"package":{"name":"ronanguilloux\/isocodes","description":"PHP library - Validators for standards from ISO, International Finance, Public Administrations, GS1, Book and Music Industries, Phone numbers \u0026 Zipcodes for many countries","time":"2012-10-13T13:21:32+00:00","maintainers":[{"name":"Ronan","avatar_url":"https:\/\/www.gravatar.com\/avatar\/19cd6c72ef2056b4526a517ee982df3d?d=identicon"}],"versions":{"dev-master":{"name":null,"description":"","keywords":["validator","book","swift","vat","zipcode","standard","IBAN","BBAN","RIB","Credit Card number","INSEE","NSS","Siren","Siret","Ssn","EAN13","BIC","finance","iso","ISBN","CIF","NIF","NINO","phone number","gtin","UPC-A","gs1","sscc","gln","SEDOL","ISIN","UCC-13","DUN-14","ITF","GS-1","GRAI","GDTI","GSRN","DUN","Public Administrations","UDI","ISMN","ISWC","HETU"],"homepage":"","version":"dev-master","version_normalized":"9999999-dev","license":null,"authors":[{"name":"Ronan Guilloux","email":"[email protected]","homepage":"http:\/\/github.com\/ronanguilloux","role":"Developer"}],"source":null,"dist":null,"type":null,"time":"2017-12-15T08:48:27+00:00","require":{"php":"^5.6 || ^7.0","giggsey\/libphonenumber-for-php":"^7.2|~8.0"},"require-dev":{"phpmd\/phpmd":"@stable","pdepend\/pdepend":"~2.1","squizlabs\/php_codesniffer":"~2.5","satooshi\/php-coveralls":"~1.0","symfony\/phpunit-bridge":"^3.0","sebastian\/phpcpd":"~2.0","friendsofphp\/php-cs-fixer":"~1.11","phploc\/phploc":"~3.0","phpunit\/phpunit":"^5.4.3 || ^6.0"},"suggest":{"sllh\/iso-codes-validator":"For Symfony or Silex integration with ease","gourmet\/validation":"For CakePHP 3 integration","pixelpeter\/laravel5-isocodes-validation":"For Laravel 5 integration"}},"dev-fix-hhvm":{"name":null,"description":"","keywords":["validator","book","swift","vat","zipcode","standard","IBAN","BBAN","RIB","Credit Card number","INSEE","NSS","Siren","Siret","Ssn","EAN13","BIC","finance","iso","ISBN","CIF","NIF","NINO","phone number","gtin","UPC-A","gs1","sscc","gln","SEDOL","ISIN","UCC-13","DUN-14","ITF","GS-1","GRAI","GDTI","GSRN","DUN","Public Administrations","UDI","ISMN","ISWC"],"homepage":"","version":"dev-fix-hhvm","version_normalized":"dev-fix-hhvm","license":null,"authors":[{"name":"Ronan Guilloux","email":"[email protected]","homepage":"http:\/\/github.com\/ronanguilloux","role":"Developer"}],"source":null,"dist":null,"type":null,"time":"2017-12-03T11:20:17+00:00","require":{"php":"^5.6 || ^7.0","giggsey\/libphonenumber-for-php":"^7.2|~8.0"},"require-dev":{"phpunit\/phpunit":"^5.4.3 || ^6.0","squizlabs\/php_codesniffer":"~2.5","sebastian\/phpcpd":"~2.0","phploc\/phploc":"~3.0","phpmd\/phpmd":"@stable","pdepend\/pdepend":"~2.1","friendsofphp\/php-cs-fixer":"~1.11","satooshi\/php-coveralls":"~1.0","symfony\/phpunit-bridge":"^3.0"},"suggest":{"sllh\/iso-codes-validator":"For Symfony or Silex integration with ease","gourmet\/validation":"For CakePHP 3 integration","pixelpeter\/laravel5-isocodes-validation":"For Laravel 5 integration"}},"2.1.3":{"name":null,"description":"","keywords":["validator","book","swift","vat","zipcode","standard","IBAN","BBAN","RIB","Credit Card number","INSEE","NSS","Siren","Siret","Ssn","EAN13","BIC","finance","iso","ISBN","CIF","NIF","NINO","phone number","gtin","UPC-A","gs1","sscc","gln","SEDOL","ISIN","UCC-13","DUN-14","ITF","GS-1","GRAI","GDTI","GSRN","DUN","Public Administrations","UDI","ISMN","ISWC"],"homepage":"","version":"2.1.3","version_normalized":"2.1.3.0","license":null,"authors":[{"name":"Ronan Guilloux","email":"[email protected]","homepage":"http:\/\/github.com\/ronanguilloux","role":"Developer"}],"source":null,"dist":null,"type":null,"time":"2017-12-02T16:35:59+00:00","require":{"php":"^5.6 || ^7.0","giggsey\/libphonenumber-for-php":"^7.2|~8.0"},"require-dev":{"phpunit\/phpunit":"^5.4.3 || ^6.0","squizlabs\/php_codesniffer":"~2.5","sebastian\/phpcpd":"~2.0","phploc\/phploc":"~3.0","phpmd\/phpmd":"@stable","pdepend\/pdepend":"~2.1","friendsofphp\/php-cs-fixer":"~1.11","satooshi\/php-coveralls":"~1.0","symfony\/phpunit-bridge":"^3.0"},"suggest":{"sllh\/iso-codes-validator":"For Symfony or Silex integration with ease","gourmet\/validation":"For CakePHP 3 integration","pixelpeter\/laravel5-isocodes-validation":"For Laravel 5 integration"}},"2.1.2":{"name":null,"description":"","keywords":["validator","book","swift","vat","zipcode","standard","IBAN","BBAN","RIB","Credit Card number","INSEE","NSS","Siren","Siret","Ssn","EAN13","BIC","finance","iso","ISBN","CIF","NIF","NINO","phone number","gtin","UPC-A","gs1","sscc","gln","SEDOL","ISIN","UCC-13","DUN-14","ITF","GS-1","GRAI","GDTI","GSRN","DUN","Public Administrations","UDI","ISMN","ISWC"],"homepage":"","version":"2.1.2","version_normalized":"2.1.2.0","license":null,"authors":[{"name":"Ronan Guilloux","email":"[email protected]","homepage":"http:\/\/github.com\/ronanguilloux","role":"Developer"}],"source":null,"dist":null,"type":null,"time":"2017-08-08T17:21:50+00:00","require":{"php":"^5.6 || ^7.0","ext-bcmath":"*","giggsey\/libphonenumber-for-php":"^7.2|~8.0"},"require-dev":{"phpunit\/phpunit":"~5.2","squizlabs\/php_codesniffer":"~2.5","sebastian\/phpcpd":"~2.0","phploc\/phploc":"~3.0","phpmd\/phpmd":"@stable","pdepend\/pdepend":"~2.1","friendsofphp\/php-cs-fixer":"~1.11","satooshi\/php-coveralls":"~1.0","symfony\/phpunit-bridge":"^3.0"},"suggest":{"sllh\/iso-codes-validator":"For Symfony or Silex integration with ease","gourmet\/validation":"For CakePHP 3 integration","pixelpeter\/laravel5-isocodes-validation":"For Laravel 5 integration"}},"2.1.1":{"name":null,"description":"","keywords":["validator","book","swift","vat","zipcode","standard","IBAN","BBAN","RIB","Credit Card number","INSEE","NSS","Siren","Siret","Ssn","EAN13","BIC","finance","iso","ISBN","CIF","NIF","NINO","phone number","gtin","UPC-A","gs1","sscc","gln","SEDOL","ISIN","UCC-13","DUN-14","ITF","GS-1","GRAI","GDTI","GSRN","DUN","Public Administrations","UDI","ISMN","ISWC"],"homepage":"","version":"2.1.1","version_normalized":"2.1.1.0","license":null,"authors":[{"name":"Ronan Guilloux","email":"[email protected]","homepage":"http:\/\/github.com\/ronanguilloux","role":"Developer"}],"source":null,"dist":null,"type":null,"time":"2017-01-10T09:29:26+00:00","require":{"php":"^5.6 || ^7.0","ext-bcmath":"*","giggsey\/libphonenumber-for-php":"^7.2|~8.0"},"require-dev":{"phpunit\/phpunit":"~5.2","squizlabs\/php_codesniffer":"~2.5","sebastian\/phpcpd":"~2.0","phploc\/phploc":"~3.0","phpmd\/phpmd":"@stable","pdepend\/pdepend":"~2.1","friendsofphp\/php-cs-fixer":"~1.11","satooshi\/php-coveralls":"~1.0","symfony\/phpunit-bridge":"^3.0"},"suggest":{"sllh\/iso-codes-validator":"For Symfony or Silex integration with ease","gourmet\/validation":"For CakePHP 3 integration","pixelpeter\/laravel5-isocodes-validation":"For Laravel 5 integration"}},"2.1.0":{"name":null,"description":"","keywords":["swift","vat","zipcode","ISO codes","IBAN","BBAN","RIB","Credit Card number","INSEE","NSS","Siren","Siret","Ssn","EAN13","BIC","ISBN","CIF","NIF","NINO","phone number","gtin","UPC-A","gs1","sscc","SEDOL","ISIN","UCC-13","DUN-14","ITF","GS-1"],"homepage":"","version":"2.1.0","version_normalized":"2.1.0.0","license":null,"authors":[{"name":"Ronan Guilloux","email":"[email protected]","homepage":"http:\/\/github.com\/ronanguilloux","role":"Developer"}],"source":null,"dist":null,"type":null,"time":"2016-03-20T14:01:15+00:00","require":{"php":"\u003E=5.6.0","ext-bcmath":"*","giggsey\/libphonenumber-for-php":"^7.2"},"require-dev":{"phpunit\/phpunit":"~5.2","squizlabs\/php_codesniffer":"~2.5","sebastian\/phpcpd":"2.0","phploc\/phploc":"3.0","phpmd\/phpmd":"@stable","pdepend\/pdepend":"~2.1","fabpot\/php-cs-fixer":"~1.11","satooshi\/php-coveralls":"~1.0","symfony\/phpunit-bridge":"^3.0"},"suggest":{"sllh\/iso-codes-validator":"For Symfony or Silex integration with ease","gourmet\/validation":"For CakePHP 3 integration"}},"2.0.0":{"name":null,"description":"","keywords":["swift","vat","zipcode","ISO codes","IBAN","BBAN","RIB","Credit Card number","INSEE","NSS","Siren","Siret","Ssn","EAN13","BIC","ISBN","CIF","NIF","NINO","SEDOL"],"homepage":"","version":"2.0.0","version_normalized":"2.0.0.0","license":null,"authors":[{"name":"Ronan Guilloux","email":"[email protected]","homepage":"http:\/\/github.com\/ronanguilloux","role":"Developer"}],"source":null,"dist":null,"type":null,"time":"2015-12-27T13:23:00+00:00","require":{"ext-bcmath":"*","php":"\u003E=5.6.0"},"require-dev":{"squizlabs\/php_codesniffer":"~2.3","sebastian\/phpcpd":"*","phploc\/phploc":"*","phpmd\/phpmd":"@stable","pdepend\/pdepend":"~2.1","fabpot\/php-cs-fixer":"~1.9","symfony\/phpunit-bridge":"^2.7.4","phpunit\/phpunit":"~5.1","satooshi\/php-coveralls":"~0.7"},"suggest":{"sllh\/iso-codes-validator":"For Symfony or Silex integration with ease","gourmet\/validation":"For CakePHP 3 integration"}},"1.2.0":{"name":null,"description":"","keywords":["swift","vat","zipcode","ISO codes","IBAN","BBAN","RIB","Credit Card number","INSEE","NSS","Siren","Siret","Ssn","EAN13","BIC","ISBN","CIF","NIF","NINO"],"homepage":"","version":"1.2.0","version_normalized":"1.2.0.0","license":null,"authors":[{"name":"Ronan Guilloux","email":"[email protected]","homepage":"http:\/\/github.com\/ronanguilloux","role":"Developer"}],"source":null,"dist":null,"type":null,"time":"2015-06-22T19:37:41+00:00","require":{"php":"\u003E=5.4.0","ext-bcmath":"*"},"require-dev":{"phpunit\/phpunit":"~4.7","squizlabs\/php_codesniffer":"2.0.x-dev","sebastian\/phpcpd":"*","phploc\/phploc":"*","phpmd\/phpmd":"@stable","pdepend\/pdepend":"2.0.*","fabpot\/php-cs-fixer":"@stable","satooshi\/php-coveralls":"dev-master"},"suggest":{"sllh\/iso-codes-validator":"For Symfony or Silex integration with ease","gourmet\/validation":"For CakePHP 3 integration"}},"1.1.4":{"name":null,"description":"","keywords":["swift","vat","zipcode","ISO codes","IBAN","BBAN","RIB","Credit Card number","INSEE","NSS","Siren","Siret","Ssn","EAN13","BIC","CIF","NIF","NINO"],"homepage":"","version":"1.1.4","version_normalized":"1.1.4.0","license":null,"authors":[{"name":"Ronan Guilloux","email":"[email protected]","homepage":"http:\/\/github.com\/ronanguilloux","role":"Developer"}],"source":null,"dist":null,"type":null,"time":"2015-05-02T15:40:23+00:00","require":{"ext-bcmath":"*","php":"\u003E=5.4.0"},"require-dev":{"phpunit\/phpunit":"~4.6","squizlabs\/php_codesniffer":"2.0.x-dev","sebastian\/phpcpd":"*","phploc\/phploc":"*","phpmd\/phpmd":"@stable","pdepend\/pdepend":"2.0.*","fabpot\/php-cs-fixer":"@stable","satooshi\/php-coveralls":"dev-master"}},"1.1.3":{"name":null,"description":"","keywords":["swift","vat","zipcode","ISO codes","IBAN","BBAN","RIB","Credit Card number","INSEE","NSS","Siren","Siret","Ssn","EAN13","BIC","CIF","NIF","NINO"],"homepage":"","version":"1.1.3","version_normalized":"1.1.3.0","license":null,"authors":[{"name":"Ronan Guilloux","email":"[email protected]","homepage":"http:\/\/github.com\/ronanguilloux","role":"Developer"}],"source":null,"dist":null,"type":null,"time":"2015-05-02T15:36:57+00:00","require":{"php":"\u003E=5.3.0","ext-bcmath":"*"},"require-dev":{"phpunit\/phpunit":"~4.6","squizlabs\/php_codesniffer":"2.0.x-dev","sebastian\/phpcpd":"*","phploc\/phploc":"*","phpmd\/phpmd":"@stable","pdepend\/pdepend":"2.0.*","fabpot\/php-cs-fixer":"@stable","satooshi\/php-coveralls":"dev-master"}},"1.1.2":{"name":null,"description":"","keywords":["swift","vat","zipcode","ISO codes","IBAN","BBAN","RIB","Credit Card number","INSEE","NSS","Siren","Siret","Ssn","EAN13","BIC","CIF","NIF","NINO"],"homepage":"","version":"1.1.2","version_normalized":"1.1.2.0","license":null,"authors":[{"name":"Ronan Guilloux","email":"[email protected]","homepage":"http:\/\/github.com\/ronanguilloux","role":"Developer"}],"source":null,"dist":null,"type":null,"time":"2015-05-02T15:35:28+00:00","require":{"php":"\u003E=5.3.0"},"require-dev":{"phpunit\/phpunit":"~4.4","squizlabs\/php_codesniffer":"2.0.x-dev","sebastian\/phpcpd":"*","phploc\/phploc":"*","phpmd\/phpmd":"2.0.*","pdepend\/pdepend":"2.0.*","fabpot\/php-cs-fixer":"@stable","satooshi\/php-coveralls":"dev-master"}},"1.1.1":{"name":null,"description":"","keywords":["swift","vat","zipcode","ISO codes","IBAN","BBAN","RIB","Credit Card number","INSEE","NSS","Siren","Siret","Ssn","Uknin","EAN13","BIC","CIF","NIF"],"homepage":"","version":"1.1.1","version_normalized":"1.1.1.0","license":null,"authors":[{"name":"Ronan Guilloux","email":"[email protected]","homepage":"http:\/\/github.com\/ronanguilloux","role":"Developer"}],"source":null,"dist":null,"type":null,"time":"2015-05-02T15:18:14+00:00","require":{"php":"\u003E=5.3.0"},"require-dev":{"phpunit\/phpunit":"~3.7","squizlabs\/php_codesniffer":"2.0.x-dev","sebastian\/phpcpd":"*","phploc\/phploc":"*","phpmd\/phpmd":"2.0.*","pdepend\/pdepend":"2.0.*","fabpot\/php-cs-fixer":"@stable"}},"1.1.0":{"name":null,"description":"","keywords":["swift","vat","zipcode","ISO codes","IBAN","BBAN","RIB","Credit Card number","INSEE","NSS","Siren","Siret","Ssn","Uknin","EAN13","BIC"],"homepage":"","version":"1.1.0","version_normalized":"1.1.0.0","license":null,"authors":[{"name":"Ronan Guilloux","email":"[email protected]","homepage":"http:\/\/github.com\/ronanguilloux","role":"Developer"}],"source":null,"dist":null,"type":null,"time":"2015-05-02T15:15:45+00:00","require":{"php":"\u003E=5.3.0"},"require-dev":{"satooshi\/php-coveralls":"dev-master"}},"1.0.2":{"name":null,"description":"","keywords":["swift","vat","zipcode","ISO codes","IBAN","BBAN","RIB","Credit Card number","INSEE","NSS","Siren","Siret","Ssn","Uknin","EAN13","BIC"],"homepage":"","version":"1.0.2","version_normalized":"1.0.2.0","license":null,"authors":[{"name":"Ronan Guilloux","email":"[email protected]","homepage":"http:\/\/github.com\/ronanguilloux","role":"Developer"}],"source":null,"dist":null,"type":null,"time":"2015-05-02T15:12:54+00:00","require":{"php":"\u003E=5.3.0"},"require-dev":{"satooshi\/php-coveralls":"dev-master"}},"1.0.1":{"name":null,"description":"","keywords":["swift","vat","zipcode","ISO codes","IBAN","BBAN","RIB","Credit Card number","INSEE","NSS","Siren","Siret","Ssn","Uknin","EAN13","BIC"],"homepage":"","version":"1.0.1","version_normalized":"1.0.1.0","license":null,"authors":[{"name":"Ronan Guilloux","email":"[email protected]","homepage":"http:\/\/github.com\/ronanguilloux","role":"Developer"}],"source":null,"dist":null,"type":null,"time":"2015-05-02T15:10:22+00:00","require":{"php":"\u003E=5.3.0"},"require-dev":{"satooshi\/php-coveralls":"dev-master"}},"1.0.0":{"name":null,"description":"","keywords":["swift","vat","zipcode","ISO codes","IBAN","BBAN","RIB","Credit Card number","INSEE","NSS","Siren","Siret","Ssn","Uknin","EAN13","BIC"],"homepage":"","version":"1.0.0","version_normalized":"1.0.0.0","license":null,"authors":[{"name":"Ronan Guilloux","email":"[email protected]","homepage":"http:\/\/github.com\/ronanguilloux","role":"Developer"}],"source":null,"dist":null,"type":null,"time":"2015-05-02T15:06:15+00:00","require":{"php":"\u003E=5.3.0"},"require-dev":{"satooshi\/php-coveralls":"dev-master"}}},"type":"library","repository":"https:\/\/github.com\/ronanguilloux\/IsoCodes","github_stars":492,"github_watchers":22,"github_forks":59,"github_open_issues":18,"language":"PHP","dependents":9,"suggesters":0,"downloads":{"total":195378,"monthly":7682,"daily":5},"favers":496}}
7 changes: 7 additions & 0 deletions spec/Packagist/Api/Result/FactorySpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ function it_creates_packages_with_dependents()
$this->create($data)->shouldHaveType('Packagist\Api\Result\Package');
}

function it_creates_packages_with_null_source()
{
$data = json_decode(file_get_contents('spec/Packagist/Api/Fixture/get_null_source.json'), true);

$this->create($data)->shouldHaveType('Packagist\Api\Result\Package');
}

public function getMatchers()
{
return array(
Expand Down
4 changes: 3 additions & 1 deletion src/Packagist/Api/Result/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ public function createPackageResults(array $package)
$version['authors'][$key] = $this->createResult('Packagist\Api\Result\Package\Author', $author);
}
}
$version['source'] = $this->createResult('Packagist\Api\Result\Package\Source', $version['source']);
if ($version['source']) {
$version['source'] = $this->createResult('Packagist\Api\Result\Package\Source', $version['source']);
}
if (isset($version['dist']) && $version['dist']) {
$version['dist'] = $this->createResult('Packagist\Api\Result\Package\Dist', $version['dist']);
}
Expand Down

0 comments on commit 8d9d0f8

Please sign in to comment.