Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 2322614

Browse files
committed
Switch to sprintf for variable interpolation.
1 parent 2c80f45 commit 2322614

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/HeaderSecurity.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,10 @@ public static function isValid($value)
130130
public static function assertValid($value)
131131
{
132132
if (! self::isValid($value)) {
133-
throw new InvalidArgumentException("'$value' is not valid header value");
133+
throw new InvalidArgumentException(sprintf(
134+
'"%s" is not valid header value',
135+
$value
136+
));
134137
}
135138
}
136139

@@ -144,7 +147,10 @@ public static function assertValid($value)
144147
public static function assertValidName($name)
145148
{
146149
if (! preg_match('/^[a-zA-Z0-9\'`#$%&*+.^_|~!-]+$/', $name)) {
147-
throw new InvalidArgumentException("'$name' is not valid header name");
150+
throw new InvalidArgumentException(sprintf(
151+
'"%s" is not valid header name',
152+
$name
153+
));
148154
}
149155
}
150156
}

0 commit comments

Comments
 (0)