PHP Class Pop\Archive\Archive

Author: Nick Sagona, III ([email protected])
Show file Open project: nicksagona/PopPHP Class Usage Examples

Protected Properties

Property Type Description
$adapter mixed Archive adapter
$allowed array Array of allowed file types.

Public Methods

Method Description
__construct ( string $archive, string $password = null, string $prefix = 'Pop\Archive\Adapter\' ) : Archive Constructor
adapter ( ) : mixed Method to return the adapter object
addFiles ( string | array $files ) : Archive Method to create an archive file
archive ( ) : mixed Method to return the archive object within the adapter object
compress ( string $ext = 'gz' ) : Archive Method to compress an archive file with Gzip or Bzip2
extract ( string $to = null ) : Archive Method to extract an archived and/or compressed file
factory ( string $archive, string $password = null ) : Archive Static method to instantiate the archive object and return itself to facilitate chaining methods together.
formats ( ) : array Get formats
listFiles ( boolean $full = false ) : array Method to return a listing of the contents of an archived file

Protected Methods

Method Description
setAdapter ( string $password = null, string $prefix ) : void Method to set the adapter based on the file name

Method Details

__construct() public method

Instantiate the archive object
public __construct ( string $archive, string $password = null, string $prefix = 'Pop\Archive\Adapter\' ) : Archive
$archive string
$password string
$prefix string
return Archive

adapter() public method

Method to return the adapter object
public adapter ( ) : mixed
return mixed

addFiles() public method

Method to create an archive file
public addFiles ( string | array $files ) : Archive
$files string | array
return Archive

archive() public method

Method to return the archive object within the adapter object
public archive ( ) : mixed
return mixed

compress() public method

Method to compress an archive file with Gzip or Bzip2
public compress ( string $ext = 'gz' ) : Archive
$ext string
return Archive

extract() public method

Method to extract an archived and/or compressed file
public extract ( string $to = null ) : Archive
$to string
return Archive

factory() public static method

Static method to instantiate the archive object and return itself to facilitate chaining methods together.
public static factory ( string $archive, string $password = null ) : Archive
$archive string
$password string
return Archive

formats() public static method

Get formats
public static formats ( ) : array
return array

listFiles() public method

Method to return a listing of the contents of an archived file
public listFiles ( boolean $full = false ) : array
$full boolean
return array

setAdapter() protected method

Method to set the adapter based on the file name
protected setAdapter ( string $password = null, string $prefix ) : void
$password string
$prefix string
return void

Property Details

$adapter protected property

Archive adapter
protected mixed $adapter
return mixed

$allowed protected property

Array of allowed file types.
protected array $allowed
return array