File tree Expand file tree Collapse file tree 8 files changed +12
-12
lines changed
src/Symfony/Component/Notifier/Bridge/Discord Expand file tree Collapse file tree 8 files changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ final class DiscordAuthorEmbedObject extends AbstractDiscordEmbedObject
25
25
*/
26
26
public function name (string $ name ): static
27
27
{
28
- if (\strlen ($ name ) > self ::NAME_LIMIT ) {
28
+ if (mb_strlen ($ name, ' UTF-8 ' ) > self ::NAME_LIMIT ) {
29
29
throw new LengthException (sprintf ('Maximum length for the name is %d characters. ' , self ::NAME_LIMIT ));
30
30
}
31
31
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ final class DiscordEmbed extends AbstractDiscordEmbed
27
27
*/
28
28
public function title (string $ title ): static
29
29
{
30
- if (\strlen ($ title ) > self ::TITLE_LIMIT ) {
30
+ if (mb_strlen ($ title, ' UTF-8 ' ) > self ::TITLE_LIMIT ) {
31
31
throw new LengthException (sprintf ('Maximum length for the title is %d characters. ' , self ::TITLE_LIMIT ));
32
32
}
33
33
@@ -41,7 +41,7 @@ public function title(string $title): static
41
41
*/
42
42
public function description (string $ description ): static
43
43
{
44
- if (\strlen ($ description ) > self ::DESCRIPTION_LIMIT ) {
44
+ if (mb_strlen ($ description, ' UTF-8 ' ) > self ::DESCRIPTION_LIMIT ) {
45
45
throw new LengthException (sprintf ('Maximum length for the description is %d characters. ' , self ::DESCRIPTION_LIMIT ));
46
46
}
47
47
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ final class DiscordFieldEmbedObject extends AbstractDiscordEmbedObject
26
26
*/
27
27
public function name (string $ name ): static
28
28
{
29
- if (\strlen ($ name ) > self ::NAME_LIMIT ) {
29
+ if (mb_strlen ($ name, ' UTF-8 ' ) > self ::NAME_LIMIT ) {
30
30
throw new LengthException (sprintf ('Maximum length for the name is %d characters. ' , self ::NAME_LIMIT ));
31
31
}
32
32
@@ -40,7 +40,7 @@ public function name(string $name): static
40
40
*/
41
41
public function value (string $ value ): static
42
42
{
43
- if (\strlen ($ value ) > self ::VALUE_LIMIT ) {
43
+ if (mb_strlen ($ value, ' UTF-8 ' ) > self ::VALUE_LIMIT ) {
44
44
throw new LengthException (sprintf ('Maximum length for the value is %d characters. ' , self ::VALUE_LIMIT ));
45
45
}
46
46
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ final class DiscordFooterEmbedObject extends AbstractDiscordEmbedObject
25
25
*/
26
26
public function text (string $ text ): static
27
27
{
28
- if (\strlen ($ text ) > self ::TEXT_LIMIT ) {
28
+ if (mb_strlen ($ text, ' UTF-8 ' ) > self ::TEXT_LIMIT ) {
29
29
throw new LengthException (sprintf ('Maximum length for the text is %d characters. ' , self ::TEXT_LIMIT ));
30
30
}
31
31
Original file line number Diff line number Diff line change @@ -38,6 +38,6 @@ public function testThrowsWhenNameExceedsCharacterLimit()
38
38
$ this ->expectException (LengthException::class);
39
39
$ this ->expectExceptionMessage ('Maximum length for the name is 256 characters. ' );
40
40
41
- (new DiscordAuthorEmbedObject ())->name (str_repeat ('h ' , 257 ));
41
+ (new DiscordAuthorEmbedObject ())->name (str_repeat ('š ' , 257 ));
42
42
}
43
43
}
Original file line number Diff line number Diff line change @@ -45,15 +45,15 @@ public function testThrowsWhenTitleExceedsCharacterLimit()
45
45
$ this ->expectException (LengthException::class);
46
46
$ this ->expectExceptionMessage ('Maximum length for the title is 256 characters. ' );
47
47
48
- (new DiscordEmbed ())->title (str_repeat ('h ' , 257 ));
48
+ (new DiscordEmbed ())->title (str_repeat ('š ' , 257 ));
49
49
}
50
50
51
51
public function testThrowsWhenDescriptionExceedsCharacterLimit ()
52
52
{
53
53
$ this ->expectException (LengthException::class);
54
54
$ this ->expectExceptionMessage ('Maximum length for the description is 4096 characters. ' );
55
55
56
- (new DiscordEmbed ())->description (str_repeat ('h ' , 4097 ));
56
+ (new DiscordEmbed ())->description (str_repeat ('š ' , 4097 ));
57
57
}
58
58
59
59
public function testThrowsWhenFieldsLimitReached ()
Original file line number Diff line number Diff line change @@ -36,14 +36,14 @@ public function testThrowsWhenNameExceedsCharacterLimit()
36
36
$ this ->expectException (LengthException::class);
37
37
$ this ->expectExceptionMessage ('Maximum length for the name is 256 characters. ' );
38
A3E2
38
39
- (new DiscordFieldEmbedObject ())->name (str_repeat ('h ' , 257 ));
39
+ (new DiscordFieldEmbedObject ())->name (str_repeat ('š ' , 257 ));
40
40
}
41
41
42
42
public function testThrowsWhenValueExceedsCharacterLimit ()
43
43
{
44
44
$ this ->expectException (LengthException::class);
45
45
$ this ->expectExceptionMessage ('Maximum length for the value is 1024 characters. ' );
46
46
47
- (new DiscordFieldEmbedObject ())->value (str_repeat ('h ' , 1025 ));
47
+ (new DiscordFieldEmbedObject ())->value (str_repeat ('š ' , 1025 ));
48
48
}
49
49
}
Original file line number Diff line number Diff line change @@ -36,6 +36,6 @@ public function testThrowsWhenTextExceedsCharacterLimit()
36
36
$ this ->expectException (LengthException::class);
37
37
$ this ->expectExceptionMessage ('Maximum length for the text is 2048 characters. ' );
38
38
39
- (new DiscordFooterEmbedObject ())->text (str_repeat ('h ' , 2049 ));
39
+ (new DiscordFooterEmbedObject ())->text (str_repeat ('š ' , 2049 ));
40
40
}
41
41
}
You can’t perform that action at this time.
0 commit comments