12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
- namespace App\Model;
- class Pharmacy extends ModelAbstract
- {
- public $id;
- public $name;
- public $city;
- public $street;
- public $house;
- public $phone;
- public function __construct(string $name, string $city, string $street, string $house, string $phone, int $id = null)
- {
- $this->name = $name;
- $this->city = $city;
- $this->street = $street;
- $this->house = $house;
- $this->phone = $phone;
- $this->id = $id;
- }
- public function validate(): bool
- {
- if (iconv_strlen($this->name) > 50 || iconv_strlen($this->name) < 2) {
- return false;
- }
- if (iconv_strlen($this->city) > 50 || iconv_strlen($this->city) < 2) {
- return false;
- }
- if (iconv_strlen($this->street) > 50 || iconv_strlen($this->street) < 2) {
- return false;
- }
- if (iconv_strlen($this->house) > 50 || iconv_strlen($this->house) < 1) {
- return false;
- }
- if (iconv_strlen($this->phone) > 15 || iconv_strlen($this->phone) < 7) {
- return false;
- }
- return true;
- }
- }
|