14
14
15
15
final class FilePermission
16
16
{
17
+ private const INVAlID_PERMISSION = 'Invalid permission. ' ;
18
+
17
19
private ?int $ defaultModeFiles = null ;
18
20
19
21
private ?int $ defaultModeFolders = null ;
@@ -54,7 +56,7 @@ public function __construct(array $directories)
54
56
public function setDefaultModeFile (int $ defaultModeFiles ): self
55
57
{
56
58
if (!$ this ->isValidMode ($ defaultModeFiles )) {
57
- throw new InvalidArgumentException (' Invalid permission. ' );
59
+ throw new InvalidArgumentException (self ::INVAlID_PERMISSION );
58
60
}
59
61
60
62
$ this ->defaultModeFiles = $ defaultModeFiles ;
@@ -65,7 +67,7 @@ public function setDefaultModeFile(int $defaultModeFiles): self
65
67
public function setDefaultModeFolder (int $ defaultModeFolders ): self
66
68
{
67
69
if (!$ this ->isValidMode ($ defaultModeFolders )) {
68
- throw new InvalidArgumentException (' Invalid permission. ' );
70
+ throw new InvalidArgumentException (self ::INVAlID_PERMISSION );
69
71
}
70
72
71
73
$ this ->defaultModeFolders = $ defaultModeFolders ;
@@ -88,7 +90,7 @@ public function setAllowedModeFiles(array $allowedModeFiles): self
88
90
{
89
91
foreach ($ allowedModeFiles as $ allowedModeFile ) {
90
92
if (!$ this ->isValidMode ($ allowedModeFile )) {
91
- throw new InvalidArgumentException (' Invalid permission. ' );
93
+ throw new InvalidArgumentException (self ::INVAlID_PERMISSION );
92
94
}
93
95
}
94
96
@@ -113,7 +115,7 @@ public function setAllowedModeFolders(
113
115
): self {
114
116
foreach ($ allowedModeFolders as $ allowedModeFolder ) {
115
117
if (!$ this ->isValidMode ($ allowedModeFolder )) {
116
- throw new InvalidArgumentException (' Invalid permission. ' );
118
+ throw new InvalidArgumentException (self ::INVAlID_PERMISSION );
117
119
}
118
120
}
119
121
0 commit comments