/** * Метод проверяет правильность имени. * * @return bool возвращает true, если имя успешно прошло проверку, иначе false. */ public function isValid() { if ($this->codeName == self::NAME_PERSON) { $result = BaseService::isPersonName($this->name, $this->minLengthName, $this->maxLengthName); } elseif ($this->codeName == self::NAME_DEPARTMENT) { $result = BaseService::isDepartmentName($this->name, $this->minLengthName, $this->maxLengthName); } if (!$result) { $this->brokenRuleMessage = '"' . $this->name . '" - недопустимое имя.'; } return $result; }