| @@ 18-28 (lines=11) @@ | ||
| 15 | /** |
|
| 16 | * @return Site[] |
|
| 17 | */ |
|
| 18 | public function getSites(): array |
|
| 19 | { |
|
| 20 | $path = 'sites'; |
|
| 21 | ||
| 22 | $response = $this->getClient()->sendRequest('GET', $path); |
|
| 23 | ||
| 24 | /** @var Site[] $models */ |
|
| 25 | $models = $this->getModelFactory()->createMany(Site::class, $response); |
|
| 26 | ||
| 27 | return $models; |
|
| 28 | } |
|
| 29 | ||
| 30 | /** |
|
| 31 | * @param int $id |
|
| @@ 35-45 (lines=11) @@ | ||
| 32 | * |
|
| 33 | * @return Site |
|
| 34 | */ |
|
| 35 | public function getSite(int $id): Site |
|
| 36 | { |
|
| 37 | $path = sprintf('sites/%d', $id); |
|
| 38 | ||
| 39 | $response = $this->getClient()->sendRequest('GET', $path); |
|
| 40 | ||
| 41 | /** @var Site $model */ |
|
| 42 | $model = $this->getModelFactory()->create(Site::class, $response); |
|
| 43 | ||
| 44 | return $model; |
|
| 45 | } |
|
| 46 | ||
| 47 | /** |
|
| 48 | * @param SitePostMessage $message |
|
| @@ 70-80 (lines=11) @@ | ||
| 67 | * |
|
| 68 | * @return Site[] |
|
| 69 | */ |
|
| 70 | public function getPlatformChildren(PlatformChildrenListMessage $message): array |
|
| 71 | { |
|
| 72 | $path = sprintf('platform/%d/children', $message->getSiteId()); |
|
| 73 | ||
| 74 | $response = $this->getClient()->sendRequest('GET', $path); |
|
| 75 | ||
| 76 | /** @var Site[] $models */ |
|
| 77 | $models = $this->getModelFactory()->createMany(Site::class, $response); |
|
| 78 | ||
| 79 | return $models; |
|
| 80 | } |
|
| 81 | } |
|
| 82 | ||