Skip to content

Commit f87fcde

Browse files
committed
refactor: moves document types to static property
1 parent e7a58d0 commit f87fcde

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

src/Files/ValueObjects/MimeType.php

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,23 @@ final class MimeType
9292
'exe' => 'application/x-msdownload',
9393
];
9494

95+
/**
96+
* Document MIME types.
97+
*
98+
* @var array<string>
99+
*/
100+
private static array $documentTypes = [
101+
'application/pdf',
102+
'application/msword',
103+
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
104+
'application/vnd.ms-excel',
105+
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
106+
'application/vnd.ms-powerpoint',
107+
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
108+
'application/vnd.oasis.opendocument.text',
109+
'application/vnd.oasis.opendocument.spreadsheet',
110+
];
111+
95112
/**
96113
* Constructor.
97114
*
@@ -207,19 +224,7 @@ public function isText(): bool
207224
*/
208225
public function isDocument(): bool
209226
{
210-
$documentTypes = [
211-
'application/pdf',
212-
'application/msword',
213-
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
214-
'application/vnd.ms-excel',
215-
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
216-
'application/vnd.ms-powerpoint',
217-
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
218-
'application/vnd.oasis.opendocument.text',
219-
'application/vnd.oasis.opendocument.spreadsheet',
220-
];
221-
222-
return in_array($this->value, $documentTypes, true);
227+
return in_array($this->value, self::$documentTypes, true);
223228
}
224229

225230
/**

0 commit comments

Comments
 (0)