WebflowSites.php 683 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace App\Http\WebflowApi;
  3. class WebflowSites extends AbstractWebflowApiCollection {
  4. public function getLoadScope(): string {
  5. return '/sites';
  6. }
  7. public function getSites(): array {
  8. return $this->getEntries(WebflowSite::class);
  9. }
  10. public function getSiteByShortName(string $sn): ?WebflowSite {
  11. foreach ($this->getSites() as $site)
  12. if (isset($site->data['shortName']) && $site->data['shortName'] == $sn)
  13. return $site;
  14. return null;
  15. }
  16. public function createEntry($key, $value): ?AbstractWebflowApiField
  17. {
  18. return new WebflowSite($this->getClient(), $value);
  19. }
  20. }
  21. ?>