-
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
bc38486
commit 93b053d
Showing
12 changed files
with
271 additions
and
279 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
<?php | ||
|
||
namespace ProgrammatorDev\SportMonksFootball\Resource; | ||
|
||
use ProgrammatorDev\SportMonksFootball\Entity\Response\RefereeCollection; | ||
use ProgrammatorDev\SportMonksFootball\Entity\Response\RefereeItem; | ||
use ProgrammatorDev\SportMonksFootball\Resource\Util\PaginationTrait; | ||
use ProgrammatorDev\Validator\Exception\ValidationException; | ||
use Psr\Http\Client\ClientExceptionInterface; | ||
|
||
class RefereeResource extends Resource | ||
{ | ||
use PaginationTrait; | ||
|
||
/** | ||
* @throws ClientExceptionInterface | ||
*/ | ||
public function getAll(): RefereeCollection | ||
{ | ||
$data = $this->api->request( | ||
method: 'GET', | ||
path: '/v3/football/referees' | ||
); | ||
|
||
return new RefereeCollection($data); | ||
} | ||
|
||
/** | ||
* @throws ClientExceptionInterface | ||
*/ | ||
public function getById(int $id): RefereeItem | ||
{ | ||
$data = $this->api->request( | ||
method: 'GET', | ||
path: $this->api->buildPath('/v3/football/referees/{id}', [ | ||
'id' => $id | ||
]) | ||
); | ||
|
||
return new RefereeItem($data); | ||
} | ||
|
||
/** | ||
* @throws ClientExceptionInterface | ||
*/ | ||
public function getAllByCountryId(int $countryId): RefereeCollection | ||
{ | ||
$data = $this->api->request( | ||
method: 'GET', | ||
path: $this->api->buildPath('/v3/football/referees/countries/{countryId}', [ | ||
'countryId' => $countryId | ||
]) | ||
); | ||
|
||
return new RefereeCollection($data); | ||
} | ||
|
||
/** | ||
* @throws ClientExceptionInterface | ||
*/ | ||
public function getAllBySeasonId(int $seasonId): RefereeCollection | ||
{ | ||
$data = $this->api->request( | ||
method: 'GET', | ||
path: $this->api->buildPath('/v3/football/referees/seasons/{seasonId}', [ | ||
'seasonId' => $seasonId | ||
]) | ||
); | ||
|
||
return new RefereeCollection($data); | ||
} | ||
|
||
/** | ||
* @throws ValidationException | ||
* @throws ClientExceptionInterface | ||
*/ | ||
public function getAllBySearchQuery(string $query): RefereeCollection | ||
{ | ||
$this->validateQuery($query, 'query'); | ||
|
||
$data = $this->api->request( | ||
method: 'GET', | ||
path: $this->api->buildPath('/v3/football/referees/search/{query}', [ | ||
'query' => $query | ||
]) | ||
); | ||
|
||
return new RefereeCollection($data); | ||
} | ||
} |
Oops, something went wrong.