| @@ 19-29 (lines=11) @@ | ||
| 16 | /** |
|
| 17 | * @return Site[] |
|
| 18 | */ |
|
| 19 | public function getSites(): array |
|
| 20 | { |
|
| 21 | $path = 'sites'; |
|
| 22 | ||
| 23 | $response = $this->getClient()->sendRequest('GET', $path); |
|
| 24 | ||
| 25 | /** @var Site[] $models */ |
|
| 26 | $models = $this->getModelFactory()->createMany(Site::class, $response); |
|
| 27 | ||
| 28 | return $models; |
|
| 29 | } |
|
| 30 | ||
| 31 | /** |
|
| 32 | * @param int $id |
|
| @@ 36-46 (lines=11) @@ | ||
| 33 | * |
|
| 34 | * @return Site |
|
| 35 | */ |
|
| 36 | public function getSite(int $id): Site |
|
| 37 | { |
|
| 38 | $path = sprintf('sites/%d', $id); |
|
| 39 | ||
| 40 | $response = $this->getClient()->sendRequest('GET', $path); |
|
| 41 | ||
| 42 | /** @var Site $model */ |
|
| 43 | $model = $this->getModelFactory()->create(Site::class, $response); |
|
| 44 | ||
| 45 | return $model; |
|
| 46 | } |
|
| 47 | ||
| 48 | /** |
|
| 49 | * @param SitePostMessage $message |
|
| @@ 99-109 (lines=11) @@ | ||
| 96 | * |
|
| 97 | * @return Site[] |
|
| 98 | */ |
|
| 99 | public function getPlatformChildren(PlatformChildrenListMessage $message): array |
|
| 100 | { |
|
| 101 | $path = sprintf('platform/%d/children', $message->getSiteId()); |
|
| 102 | ||
| 103 | $response = $this->getClient()->sendRequest('GET', $path); |
|
| 104 | ||
| 105 | /** @var Site[] $models */ |
|
| 106 | $models = $this->getModelFactory()->createMany(Site::class, $response); |
|
| 107 | ||
| 108 | return $models; |
|
| 109 | } |
|
| 110 | } |
|
| 111 | ||
| @@ 33-43 (lines=11) @@ | ||
| 30 | * |
|
| 31 | * @return Article[] |
|
| 32 | */ |
|
| 33 | public function getArticles(ArticleListMessage $message): array |
|
| 34 | { |
|
| 35 | $path = sprintf('sites/%d/articles', $message->getSiteId()); |
|
| 36 | ||
| 37 | $response = $this->getClient()->sendRequest(RequestStatus::GET, $path); |
|
| 38 | ||
| 39 | /** @var Article[] $models */ |
|
| 40 | $models = $this->getModelFactory()->createMany(Article::class, $response); |
|
| 41 | ||
| 42 | return $models; |
|
| 43 | } |
|
| 44 | ||
| 45 | /** |
|
| 46 | * @param ArticlePostMessage $message |
|
| @@ 104-114 (lines=11) @@ | ||
| 101 | * |
|
| 102 | * @return Category[] |
|
| 103 | */ |
|
| 104 | public function getCategories(CategoryListMessage $message): array |
|
| 105 | { |
|
| 106 | $path = sprintf('sites/%d/categories', $message->getSiteId()); |
|
| 107 | ||
| 108 | $response = $this->getClient()->sendRequest(RequestStatus::GET, $path); |
|
| 109 | ||
| 110 | /** @var Category[] $models */ |
|
| 111 | $models = $this->getModelFactory()->createMany(Category::class, $response); |
|
| 112 | ||
| 113 | return $models; |
|
| 114 | } |
|
| 115 | ||
| 116 | /** |
|
| 117 | * @param CategoryPostMessage $message |
|