<?phpnamespace App\Entity\Camper;use phpDocumentor\Reflection\Types\Boolean;class CamperFilter implements \ArrayAccess, \Serializable, \JsonSerializable{ private ?string $query=null; private ?\DateTimeInterface $startDate = null; private ?\DateTimeInterface $endDate = null; private ?CamperGroup $group = null; private ?string $gender = null; public function getQuery(): ?string { return $this->query; } public function setQuery(?string $query): CamperFilter { $this->query = $query; return $this; } public function getStartDate(): ?\DateTimeInterface { return $this->startDate; } public function setStartDate(?\DateTimeInterface $startDate): CamperFilter { $this->startDate = $startDate; return $this; } public function getEndDate(): ?\DateTimeInterface { return $this->endDate; } public function setEndDate(?\DateTimeInterface $endDate): CamperFilter { $this->endDate = $endDate; return $this; } public function getGroup(): ?CamperGroup { return $this->group; } public function setGroup(?CamperGroup $group): CamperFilter { $this->group = $group; return $this; } public function getGender(): ?string { return $this->gender; } public function setGender(?string $gender): CamperFilter { $this->gender = $gender; return $this; } /***********************************************/ public function jsonSerialize() { return get_object_vars($this); } function __serialize() { return get_object_vars($this); } function __unserialize($array) { $this->unserialize(json_encode($array)); } public function serialize() { return serialize(get_object_vars($this)); } public function unserialize($serialized) { $properties = get_object_vars($this); $obj = json_decode($serialized); if (!is_object($obj)) { return; } foreach ($properties as $property => $value) {// if(array_key_exists($property,$obj)) if (property_exists($obj, $property)) { switch ($property) { case "startDate": case "endDate": break; $this->$property = new \DateTime($obj->$property); default: $this->$property = $obj->$property; break; } } } } public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; } else { $this->container[$offset] = $value; } } public function offsetExists($offset) { return isset($this->container[$offset]); } public function offsetUnset($offset) { unset($this->container[$offset]); } public function offsetGet($offset) { return isset($this->container[$offset]) ? $this->container[$offset] : null; }}