-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f82ed55
commit 3683d3f
Showing
7 changed files
with
89 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
namespace ProgrammatorDev\SportMonksFootball\Resource; | ||
|
||
use ProgrammatorDev\SportMonksFootball\Entity\Response\ContinentCollection; | ||
use ProgrammatorDev\SportMonksFootball\Entity\Response\ContinentItem; | ||
use ProgrammatorDev\SportMonksFootball\Resource\Util\PaginationTrait; | ||
use Psr\Http\Client\ClientExceptionInterface; | ||
|
||
class ContinentResource extends Resource | ||
{ | ||
use PaginationTrait; | ||
|
||
/** | ||
* @throws ClientExceptionInterface | ||
*/ | ||
public function getAll(): ContinentCollection | ||
{ | ||
$data = $this->api->request( | ||
method: 'GET', | ||
path: '/v3/core/continents' | ||
); | ||
|
||
return new ContinentCollection($data); | ||
} | ||
|
||
/** | ||
* @throws ClientExceptionInterface | ||
*/ | ||
public function getById(int $id): ContinentItem | ||
{ | ||
$data = $this->api->request( | ||
method: 'GET', | ||
path: $this->api->buildPath('/v3/core/continents/{id}', [ | ||
'id' => $id | ||
]) | ||
); | ||
|
||
return new ContinentItem($data); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace ProgrammatorDev\SportMonksFootball\Test\Integration; | ||
|
||
use ProgrammatorDev\SportMonksFootball\Entity\Response\ContinentCollection; | ||
use ProgrammatorDev\SportMonksFootball\Entity\Response\ContinentItem; | ||
use ProgrammatorDev\SportMonksFootball\Test\AbstractTest; | ||
use ProgrammatorDev\SportMonksFootball\Test\MockResponse; | ||
use ProgrammatorDev\SportMonksFootball\Test\Util\TestCollectionResponseTrait; | ||
use ProgrammatorDev\SportMonksFootball\Test\Util\TestItemResponseTrait; | ||
|
||
class ContinentResourceTest extends AbstractTest | ||
{ | ||
use TestItemResponseTrait; | ||
use TestCollectionResponseTrait; | ||
|
||
public static function provideItemResponseData(): \Generator | ||
{ | ||
yield 'get by id' => [ | ||
ContinentItem::class, | ||
MockResponse::CONTINENT_ITEM_DATA, | ||
'continents', | ||
'getById', | ||
[1] | ||
]; | ||
} | ||
|
||
public static function provideCollectionResponseData(): \Generator | ||
{ | ||
yield 'get all' => [ | ||
ContinentCollection::class, | ||
MockResponse::CONTINENT_COLLECTION_DATA, | ||
'continents', | ||
'getAll' | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters