2declare(strict_types=1);
58 if ($this->
isClean($filename)) {
63 $basename = $pathInfo[
'basename'];
64 $parentPath = $pathInfo[
'dirname'];
67 $filename = str_replace(
'.',
'', $basename);
71 if ($parentPath ===
'') {
75 return "$parentPath/$filename";
88 return strtolower(pathinfo(
$filename, PATHINFO_EXTENSION));
An exception for terminatinating execution or to throw for unit testing.
__construct()
FilenameSanitizerImpl constructor.
$whitelist
Contains the whitelisted file suffixes.
isClean(string $filename)
@inheritDoc
extractFileSuffix($filename)
Extracts the suffix from the given filename.
sanitize(string $filename)
@inheritDoc
static getValidExtensions()
Valid extensions.
const CLEAN_FILE_SUFFIX
This file suffix will be used to sanitize not whitelisted file names.