diff --git a/README.md b/README.md index 1533694..5439a7f 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ foreach ($events as $event) { #### Filters -Events can be filtered by group, category, program or intended for: +Events can be filtered by group, category, program, intended for and other options: ```php $parameters = new \HnutiBrontosaurus\BisClient\Event\Request\EventParameters(); @@ -93,6 +93,9 @@ $parameters->setIntendedFor(\HnutiBrontosaurus\BisClient\Event\IntendedFor::FIRS // only for some administration units $parameters->setAdministrationUnit(5); +// only in "Vysočina" region +$parameters->setRegion(\HnutiBrontosaurus\BisClient\Event\Request\Region::VYSOCINA()); + $events = $client->getEvents($parameters); ``` diff --git a/src/Event/Request/EventParameters.php b/src/Event/Request/EventParameters.php index bd4986e..1217817 100644 --- a/src/Event/Request/EventParameters.php +++ b/src/Event/Request/EventParameters.php @@ -54,6 +54,27 @@ public function setAdministrationUnits(array $ids): self } + // region + + /** @var Region[] */ + private array $regions = []; + + public function setRegion(Region $region): self + { + $this->regions = [$region]; + return $this; + } + + /** + * @param Region[] $regions + */ + public function setRegions(array $regions): self + { + $this->regions = $regions; + return $this; + } + + // groups /** @var Group[] */ @@ -258,6 +279,9 @@ public function toArray(): array if (count($this->administrationUnits) > 0) { $array['administration_unit'] = implode(',', $this->administrationUnits); } + if (count($this->regions) > 0) { + $array['region'] = implode(',', $this->regions); + } if (count($this->groups) > 0) { $array['group'] = implode(',', $this->groups); } diff --git a/src/Event/Request/Region.php b/src/Event/Request/Region.php new file mode 100644 index 0000000..700bab4 --- /dev/null +++ b/src/Event/Request/Region.php @@ -0,0 +1,44 @@ +