for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Clubdeuce\Tessitura\Resources;
use Exception;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
/**
* @link https://www.tessituranetwork.com/REST_v151/TessituraService/HELP/RESOURCES/SEASONS.HTM
*/
class Seasons
{
public const RESOURCE = 'ReferenceData/Seasons';
protected Client $client;
public function __construct(?Client $client = null)
if (empty($client)) {
$client = new Client();
}
$this->client = $client;
* @link https://www.tessituranetwork.com/REST_v151/TessituraService/HELP/API/GET_REFERENCEDATA_SEASONS_ID_FI.HTM
* @throws Exception
public function getById(int $id): Season
try {
$response = $this->client->get(sprintf('%s/%s', self::RESOURCE, $id));
return new Season(json_decode($response->getBody()->getContents(), true));
} catch (GuzzleException $e) {
throw new Exception($e->getMessage());
* @return Season[]
public function get(): array
$response = $this->client->get(self::RESOURCE);
$data = json_decode($response->getBody()->getContents(), true);
return array_map(function (array $season) {
return new Season($season);
}, $data);