Allows to map responses provided by the World Cups Data API.
You can install the library and its dependencies using composer
running:
$ composer require astronati/world-cups-data-response-parser
The library allows to return a model per each response and its content (round, match, team, etc...).
The following snippet can be helpful:
use WCDRP\Response\ResponseParser;
...
// Obtain a Response
$apiResponse = ... // Save this the response from the World Cups Data API
$response = ResponseParser::create($apiResponse);
...
// Get first round
$round = $response->getRounds()[0];
echo $round->getNumber(); // 1...
For more details please take a look at Response.
The environment requires phpunit, that has been already included in the dev-dependencies
of the
composer.json
.
To install all modules you just need to run following command:
$ composer install
Tests files are created in dedicates folders that replicate the src structure as follows:
.
+-- src
| +-- [folder-name]
| | +-- [file-name].php
| ...
+-- tests
| +-- [folder-name]
| | +-- [file-name]Test.php
Execute following command to run the tests suite:
$ composer test
Run what follows to see the code coverage:
$ composer coverage
This package is released under the MIT license.