getPath() . $sub) && phpOMS\Utils\StringUtils::startsWith( str_replace('\\', '/', realpath($media->getPath() . $sub)), $media->getPath() ) ) { return $media->getPath() . $sub; } return $media->getPath(); }; $dirPathFunction = function ($media, string $sub) : string { if (is_dir($media->getPath() . $sub) && phpOMS\Utils\StringUtils::startsWith( str_replace('\\', '/', realpath($media->getPath() . $sub)), $media->getPath() ) ) { return $media->getPath() . $sub; } return $media->getPath(); }; $isCollectionFunction = function ($media, string $sub) : bool { return ($media->getExtension() === 'collection' && !is_file($media->getPath() . $sub)) || (is_dir($media->getPath()) && ($sub === null || is_dir($media->getPath() . $sub)) ); }; $lineContentFunction = function (string $path) : array { $output = file_get_contents($path); $output = str_replace(["\r\n", "\r"], "\n", $output); return explode("\n", $output); }; $isImageFunction = function ($media, string $path) : bool { return FileUtils::getExtensionType($media->getExtension()) === ExtensionType::IMAGE || FileUtils::getExtensionType(File::extension($path)) === ExtensionType::IMAGE; };