PHP Class Contao\ZipReader

Usage: $zip = new ZipReader('test.zip'); while ($zip->next()) { echo $zip->->file_name; }
Afficher le fichier Open project: contao/core-bundle Class Usage Examples

Protected Properties

Свойство Type Description
$arrFiles array File list
$arrHeader array Archive header
$resFile resource File handle
$strFile string File name

Méthodes publiques

Méthode Description
__construct ( string $strFile ) Open the archive and return the file handle
__destruct ( ) Close the file handle
__get ( string $strKey ) : mixed | null Return a property of the archive header or the current file
current ( ) : array Return the current file as array
first ( ) : ZipReader Go to the first file of the archive
getFile ( string $strName ) : boolean Set the internal pointer to a particular file
getFileList ( ) : array Return a list of all files in the archive
last ( ) : ZipReader Go to the last file of the archive
next ( ) : ZipReader | boolean Go to the next file of the archive
prev ( ) : ZipReader | boolean Go to the previous file of the archive
reset ( ) : ZipReader Reset the archive
unzip ( ) : string Unzip the current file and return its contents as string

Méthodes protégées

Méthode Description
decToUnix ( integer $intTime, integer $intDate ) : integer Calculate the Unix timestamp from two hexadecimal values
readCentralDirectory ( ) : array Return a list of all files in the archive

Method Details

__construct() public méthode

Open the archive and return the file handle
public __construct ( string $strFile )
$strFile string The file path

__destruct() public méthode

Close the file handle
public __destruct ( )

__get() public méthode

Return a property of the archive header or the current file
public __get ( string $strKey ) : mixed | null
$strKey string The property name
Résultat mixed | null The property value or null

current() public méthode

Return the current file as array
public current ( ) : array
Résultat array The current file array

decToUnix() protected méthode

Calculate the Unix timestamp from two hexadecimal values
protected decToUnix ( integer $intTime, integer $intDate ) : integer
$intTime integer The time integer
$intDate integer The date integer
Résultat integer The Unix timestamp

first() public méthode

Go to the first file of the archive
public first ( ) : ZipReader
Résultat ZipReader The object instance

getFile() public méthode

Set the internal pointer to a particular file
public getFile ( string $strName ) : boolean
$strName string The file name
Résultat boolean True if the file was found

getFileList() public méthode

Return a list of all files in the archive
public getFileList ( ) : array
Résultat array The files array

last() public méthode

Go to the last file of the archive
public last ( ) : ZipReader
Résultat ZipReader The object instance

next() public méthode

Go to the next file of the archive
public next ( ) : ZipReader | boolean
Résultat ZipReader | boolean The object instance or false if there is no next file

prev() public méthode

Go to the previous file of the archive
public prev ( ) : ZipReader | boolean
Résultat ZipReader | boolean The object instance or false if there is no previous file

readCentralDirectory() protected méthode

Return a list of all files in the archive
protected readCentralDirectory ( ) : array
Résultat array The files array

reset() public méthode

Reset the archive
public reset ( ) : ZipReader
Résultat ZipReader The object instance

unzip() public méthode

Unzip the current file and return its contents as string
public unzip ( ) : string
Résultat string The file content

Property Details

$arrFiles protected_oe property

File list
protected array $arrFiles
Résultat array

$arrHeader protected_oe property

Archive header
protected array $arrHeader
Résultat array

$resFile protected_oe property

File handle
protected resource $resFile
Résultat resource

$strFile protected_oe property

File name
protected string $strFile
Résultat string