Skip to content

Commit 137375c

Browse files
committed
Fix title length with special characters
1 parent 3941ff3 commit 137375c

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/Domain/DecisionContent.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public function getStatus(): string
113113
*/
114114
private function setTitle(string $title): void
115115
{
116-
if (strlen($title) > self::TITLE_MAX_LENGTH) {
116+
if ($this->isGreaterThanTitleMaxLenght($title)) {
117117
$message = sprintf(
118118
'The title must be less than or equal to %d characters',
119119
self::TITLE_MAX_LENGTH
@@ -153,4 +153,16 @@ private function setStatus(string $status): void
153153

154154
$this->status = $status;
155155
}
156+
157+
/**
158+
* Determines whether the title is greater than maximun length set
159+
*
160+
* @param string $title
161+
*
162+
* @return bool
163+
*/
164+
private function isGreaterThanTitleMaxLenght(string $title): bool
165+
{
166+
return mb_strlen($title) > self::TITLE_MAX_LENGTH;
167+
}
156168
}

0 commit comments

Comments
 (0)