Skip to content

Commit 181866c

Browse files
committed
use const
1 parent 585fb34 commit 181866c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/Model/FilePermission.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
final class FilePermission
1616
{
17+
private const INVAlID_PERMISSION = 'Invalid permission.';
18+
1719
private ?int $defaultModeFiles = null;
1820

1921
private ?int $defaultModeFolders = null;
@@ -54,7 +56,7 @@ public function __construct(array $directories)
5456
public function setDefaultModeFile(int $defaultModeFiles): self
5557
{
5658
if (!$this->isValidMode($defaultModeFiles)) {
57-
throw new InvalidArgumentException('Invalid permission.');
59+
throw new InvalidArgumentException(self::INVAlID_PERMISSION);
5860
}
5961

6062
$this->defaultModeFiles = $defaultModeFiles;
@@ -65,7 +67,7 @@ public function setDefaultModeFile(int $defaultModeFiles): self
6567
public function setDefaultModeFolder(int $defaultModeFolders): self
6668
{
6769
if (!$this->isValidMode($defaultModeFolders)) {
68-
throw new InvalidArgumentException('Invalid permission.');
70+
throw new InvalidArgumentException(self::INVAlID_PERMISSION);
6971
}
7072

7173
$this->defaultModeFolders = $defaultModeFolders;
@@ -88,7 +90,7 @@ public function setAllowedModeFiles(array $allowedModeFiles): self
8890
{
8991
foreach ($allowedModeFiles as $allowedModeFile) {
9092
if (!$this->isValidMode($allowedModeFile)) {
91-
throw new InvalidArgumentException('Invalid permission.');
93+
throw new InvalidArgumentException(self::INVAlID_PERMISSION);
9294
}
9395
}
9496

@@ -113,7 +115,7 @@ public function setAllowedModeFolders(
113115
): self {
114116
foreach ($allowedModeFolders as $allowedModeFolder) {
115117
if (!$this->isValidMode($allowedModeFolder)) {
116-
throw new InvalidArgumentException('Invalid permission.');
118+
throw new InvalidArgumentException(self::INVAlID_PERMISSION);
117119
}
118120
}
119121

0 commit comments

Comments
 (0)