hasTarExtension.php
Table of Contents
Functions
- hasTarExtension() : bool
- Checks if a file has a tar-related extension.
Functions
hasTarExtension()
Checks if a file has a tar-related extension.
hasTarExtension(string $filePath[, array<string|int, string> $tarExtensions = [
FileExtension::TAR,
FileExtension::TGZ,
FileExtension::GZ,
FileExtension::TAR_GZ,
FileExtension::TAR_BZ2,
FileExtension::BZ2,
// Written by the system tar since 1.5.0, so they have to be recognised as tar
// archives or the library could no longer read back what it writes. Taken from
// TarExtension, which is the catalogue of tar extensions — `.gz` and `.bz2` above
// are not, which is exactly why they surprise.
TarExtension::TAR_XZ,
TarExtension::TXZ,
TarExtension::TAR_ZST,
] ]) : bool
Parameters
- $filePath : string
-
Path to the file.
- $tarExtensions : array<string|int, string> = [ FileExtension::TAR, FileExtension::TGZ, FileExtension::GZ, FileExtension::TAR_GZ, FileExtension::TAR_BZ2, FileExtension::BZ2, // Written by the system tar since 1.5.0, so they have to be recognised as tar // archives or the library could no longer read back what it writes. Taken from // TarExtension, which is the catalogue of tar extensions — `.gz` and `.bz2` above // are not, which is exactly why they surprise. TarExtension::TAR_XZ, TarExtension::TXZ, TarExtension::TAR_ZST, ]
-
Optional list of valid tar-related extensions. Defaults to common tar and compressed tar extensions:
.tar.tgz.gz.tar.gz.tar.bz2.bz2
Tags
Return values
bool —True if the file has a recognized tar extension.