-
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
3b9ba11
commit b01cc74
Showing
20 changed files
with
166 additions
and
229 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
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 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 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 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 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 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 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 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 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 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 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 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,75 @@ | ||
<?php | ||
|
||
namespace ProgrammatorDev\SportMonksFootball\Resource; | ||
|
||
use ProgrammatorDev\SportMonksFootball\Entity\Response\StageCollection; | ||
use ProgrammatorDev\SportMonksFootball\Entity\Response\StageItem; | ||
use ProgrammatorDev\SportMonksFootball\Resource\Util\PaginationTrait; | ||
use ProgrammatorDev\Validator\Exception\ValidationException; | ||
use Psr\Http\Client\ClientExceptionInterface; | ||
|
||
class StageResource extends Resource | ||
{ | ||
use PaginationTrait; | ||
|
||
/** | ||
* @throws ClientExceptionInterface | ||
*/ | ||
public function getAll(): StageCollection | ||
{ | ||
$data = $this->api->request( | ||
method: 'GET', | ||
path: '/v3/football/stages' | ||
); | ||
|
||
return new StageCollection($data); | ||
} | ||
|
||
/** | ||
* @throws ClientExceptionInterface | ||
*/ | ||
public function getById(int $id): StageItem | ||
{ | ||
$data = $this->api->request( | ||
method: 'GET', | ||
path: $this->api->buildPath('/v3/football/stages/{id}', [ | ||
'id' => $id | ||
]) | ||
); | ||
|
||
return new StageItem($data); | ||
} | ||
|
||
/** | ||
* @throws ClientExceptionInterface | ||
*/ | ||
public function getAllBySeasonId(int $seasonId): StageCollection | ||
{ | ||
$data = $this->api->request( | ||
method: 'GET', | ||
path: $this->api->buildPath('/v3/football/stages/seasons/{seasonId}', [ | ||
'seasonId' => $seasonId | ||
]) | ||
); | ||
|
||
return new StageCollection($data); | ||
} | ||
|
||
/** | ||
* @throws ValidationException | ||
* @throws ClientExceptionInterface | ||
*/ | ||
public function getAllBySearchQuery(string $query): StageCollection | ||
{ | ||
$this->validateQuery($query); | ||
|
||
$data = $this->api->request( | ||
method: 'GET', | ||
path: $this->api->buildPath('/v3/football/stages/search/{query}', [ | ||
'query' => $query | ||
]) | ||
); | ||
|
||
return new StageCollection($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
Oops, something went wrong.