id; } public function getName(): ?string { return $this->name; } public function setName(string $name): static { $this->name = $name; return $this; } public function getAddress(): ?string { return $this->address; } public function setAddress(string $address): static { $this->address = $address; return $this; } public function getAddress2(): ?string { return $this->address2; } public function setAddress2(?string $address2): static { $this->address2 = $address2; return $this; } public function getCity(): ?string { return $this->city; } public function setCity(string $city): static { $this->city = $city; return $this; } public function getState(): ?State { return $this->state; } public function setState(State $state): static { $this->state = $state; return $this; } public function getZip(): ?int { return $this->zip; } public function setZip(int $zip): static { $this->zip = $zip; return $this; } public function getCounty(): ?County { return $this->county; } public function setCounty(County $county): static { $this->county = $county; return $this; } public function getFormattedAddress(): ?string { return $this->address . ($this->address2 ? ' ' . $this->address2 : '') . '
' . $this->city . ', ' . $this->state->value . ' ' . $this->zip; } public function getPhone(): ?string { return $this->phone; } public function setPhone(?string $phone): static { $this->phone = $phone; return $this; } public function getEmail(): ?string { return $this->email; } public function setEmail(?string $email): static { $this->email = $email; return $this; } public function getUrl(): ?string { return $this->url; } public function setUrl(?string $url): static { $this->url = $url; return $this; } public function urlString(): ?string { if (preg_match("/facebook/i", $this->url)) { return ""; } else { return ""; } return null; } public function getContactCard(): ?string { $formattedPhone = ($this->phone ? '(' . substr($this->phone, 0, 3) . ') ' . substr($this->phone, 3, 3) . '-' . substr($this->phone, 6) : ''); return ($this->email ? "$this->email
" : '') . ($this->phone ? "$formattedPhone" : ''); } public function generateVCard(): string { return 'BEGIN:VCARD' . "\nVERSION:3.0" . "\nN:$this->name" . "\nFN:$this->name" . "\nORG:$this->name" . "\nADR;TYPE=WORK:;;$this->address;$this->city;{$this->state->value};$this->zip" . ($this->phone ? "\nTEL;TYPE=WORK,VOICE:$this->phone" : null) . ($this->email ? "\nEMAIL;TYPE=WORK,INTERNET:$this->email" : null) . ($this->url ? "\nURL:$this->url" : null) . "\nNOTE:$this->notes" . "\nREV:" . date('c') . "\nEND:VCARD"; } public function getMonOpen(): ?\DateTimeInterface { return $this->monOpen; } public function setMonOpen(?\DateTimeInterface $monOpen): static { $this->monOpen = $monOpen; return $this; } public function getMonClose(): ?\DateTimeInterface { return $this->monClose; } public function setMonClose(?\DateTimeInterface $monClose): static { $this->monClose = $monClose; return $this; } public function mon(): ?string { if (!$this->monOpen || !$this->monClose) { return 'C'; } $closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->monClose->format('H:i:s'), new DateTimeZone('America/Indiana/Indianapolis')); if ($closeAt <= new DateTime()) { return 'C'; } return $this->monOpen->format('g:i A') . '-' . $this->monClose->format('g:i A'); } public function getTueOpen(): ?\DateTimeInterface { return $this->tueOpen; } public function setTueOpen(?\DateTimeInterface $tueOpen): static { $this->tueOpen = $tueOpen; return $this; } public function getTueClose(): ?\DateTimeInterface { return $this->tueClose; } public function setTueClose(?\DateTimeInterface $tueClose): static { $this->tueClose = $tueClose; return $this; } public function tue(): ?string { if (!$this->tueOpen || !$this->tueClose) { return 'C'; } $closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->tueClose->format('H:i:s'), new DateTimeZone('America/Indiana/Indianapolis')); if ($closeAt <= new DateTime()) { return 'C'; } return $this->tueOpen->format('g:i A') . '-' . $this->tueClose->format('g:i A'); } public function getWedOpen(): ?\DateTimeInterface { return $this->wedOpen; } public function setWedOpen(?\DateTimeInterface $wedOpen): static { $this->wedOpen = $wedOpen; return $this; } public function getWedClose(): ?\DateTimeInterface { return $this->wedClose; } public function setWedClose(?\DateTimeInterface $wedClose): static { $this->wedClose = $wedClose; return $this; } public function wed(): ?string { if (!$this->wedOpen || !$this->wedClose) { return 'C'; } $closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->wedClose->format('H:i:s'), new DateTimeZone('America/Indiana/Indianapolis')); if ($closeAt <= new DateTime("now", new DateTimeZone('America/Indiana/Indianapolis'))) { return 'C'; } return $this->wedOpen->format('g:i A') . '-' . $this->wedClose->format('g:i A'); } public function getThuOpen(): ?\DateTimeInterface { return $this->thuOpen; } public function setThuOpen(?\DateTimeInterface $thuOpen): static { $this->thuOpen = $thuOpen; return $this; } public function getThuClose(): ?\DateTimeInterface { return $this->thuClose; } public function setThuClose(?\DateTimeInterface $thuClose): static { $this->thuClose = $thuClose; return $this; } public function thu(): ?string { if (!$this->thuOpen || !$this->thuClose) { return 'C'; } $closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->thuClose->format('H:i:s'), new DateTimeZone('America/Indiana/Indianapolis')); if ($closeAt <= new DateTime()) { return 'C'; } return $this->thuOpen->format('g:i A') . '-' . $this->thuClose->format('g:i A'); } public function getFriOpen(): ?\DateTimeInterface { return $this->friOpen; } public function setFriOpen(?\DateTimeInterface $friOpen): static { $this->friOpen = $friOpen; return $this; } public function getFriClose(): ?\DateTimeInterface { return $this->friClose; } public function setFriClose(?\DateTimeInterface $friClose): static { $this->friClose = $friClose; return $this; } public function fri(): ?string { if (!$this->friOpen || !$this->friClose) { return 'C'; } $closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->friClose->format('H:i:s'), new DateTimeZone('America/Indiana/Indianapolis')); if ($closeAt <= new DateTime()) { return 'C'; } return $this->friOpen->format('g:i A') . '-' . $this->friClose->format('g:i A'); } public function getSatOpen(): ?\DateTimeInterface { return $this->satOpen; } public function setSatOpen(?\DateTimeInterface $satOpen): static { $this->satOpen = $satOpen; return $this; } public function getSatClose(): ?\DateTimeInterface { return $this->satClose; } public function setSatClose(?\DateTimeInterface $satClose): static { $this->satClose = $satClose; return $this; } public function sat(): ?string { if (!$this->satOpen || !$this->satClose) { return 'C'; } $closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->satClose->format('H:i:s'), new DateTimeZone('America/Indiana/Indianapolis')); if ($closeAt <= new DateTime()) { return 'C'; } return $this->satOpen->format('g:i A') . '-' . $this->satClose->format('g:i A'); } public function getSunOpen(): ?\DateTimeInterface { return $this->sunOpen; } public function setSunOpen(?\DateTimeInterface $sunOpen): static { $this->sunOpen = $sunOpen; return $this; } public function getSunClose(): ?\DateTimeInterface { return $this->sunClose; } public function setSunClose(?\DateTimeInterface $sunClose): static { $this->sunClose = $sunClose; return $this; } public function sun(): ?string { if (!$this->sunOpen || !$this->sunClose) { return 'C'; } $closeAt = new DateTime($this->today->format('Y-m-d') . ' ' . $this->sunClose->format('H:i:s'), new DateTimeZone('America/Indiana/Indianapolis')); if ($closeAt <= new DateTime()) { return 'C'; } return $this->sunOpen->format('g:i A') . '-' . $this->sunClose->format('g:i A'); } public function getHours(): ?string { $this->today = new DateTime('now', new DateTimeZone('America/Indiana/Indianapolis')); switch ($this->today->format('w')) { case 0: return $this->sun(); case 1: return $this->mon(); case 2: return $this->tue(); case 3: return $this->wed(); case 4: return $this->thu(); case 5: return $this->fri(); case 6: return $this->sat(); } } public function getFormattedHours(): ?string { $mon = 'CLOSED'; $tue = 'CLOSED'; $wed = 'CLOSED'; $thu = 'CLOSED'; $fri = 'CLOSED'; $sat = 'CLOSED'; $sun = 'CLOSED'; if ($this->monOpen && $this->monClose) { $mon = $this->monOpen->format('g:i A') . '-' . $this->monClose->format('g:i A'); } if ($this->tueOpen && $this->tueClose) { $tue = $this->tueOpen->format('g:i A') . '-' . $this->tueClose->format('g:i A'); } if ($this->wedOpen && $this->wedClose) { $wed = $this->wedOpen->format('g:i A') . '-' . $this->wedClose->format('g:i A'); } if ($this->thuOpen && $this->thuClose) { $thu = $this->thuOpen->format('g:i A') . '-' . $this->thuClose->format('g:i A'); } if ($this->friOpen && $this->friClose) { $fri = $this->friOpen->format('g:i A') . '-' . $this->friClose->format('g:i A'); } if ($this->satOpen && $this->satClose) { $sat = $this->satOpen->format('g:i A') . '-' . $this->satClose->format('g:i A'); } if ($this->sunOpen && $this->sunClose) { $sun = $this->sunOpen->format('g:i A') . '-' . $this->sunClose->format('g:i A'); } return <<Sun: {$sun}

Mon: {$mon}

Tue: {$tue}

Wed: {$wed}

Thu: {$thu}

Fri: {$fri}

Sat: {$sat}

HTML; } public function getNotes(): ?string { return $this->notes; } public function setNotes(?string $notes): static { $this->notes = $notes; return $this; } public function getServicesAvailable(): ?string { return $this->servicesAvailable; } public function setServicesAvailable(?string $servicesAvailable): static { $this->servicesAvailable = $servicesAvailable; return $this; } /** * @return ResourceType[] */ public function getType(): array { return $this->type; } public function setType(array $type): static { $this->type = $type; return $this; } public function getLat(): ?float { return $this->lat; } public function setLat(?float $lat): static { $this->lat = $lat; return $this; } public function getLon(): ?float { return $this->lon; } public function setLon(?float $lon): static { $this->lon = $lon; return $this; } }