Zippy API
Class

Alchemy\Zippy\Zippy

class Zippy

Properties

$adapters

Methods

__construct(AdapterContainer $adapters)

ArchiveInterface create(string $path, String|Array|Traversable|null $files = null, Boolean $recursive = true, string|null $type = null)

Creates an archive

ArchiveInterface open(string $path)

Opens an archive.

Zippy addStrategy(FileStrategyInterface $strategy)

Adds a strategy.

array getStrategies()

Returns the strategies as they are stored

AdapterInterface getAdapterFor(string $extension)

Returns an adapter for a file extension

static Zippy load()

Creates Zippy and loads default strategies

Details

at line 35
public __construct(AdapterContainer $adapters)

Parameters

AdapterContainer $adapters

at line 52
public ArchiveInterface create(string $path, String|Array|Traversable|null $files = null, Boolean $recursive = true, string|null $type = null)

Creates an archive

Parameters

string $path
String|Array|Traversable|null $files
Boolean $recursive
string|null $type

Return Value

ArchiveInterface

Exceptions

RuntimeException In case of failure

at line 76
public ArchiveInterface open(string $path)

Opens an archive.

Parameters

string $path

Return Value

ArchiveInterface

Exceptions

RuntimeException In case of failure

at line 100
public Zippy addStrategy(FileStrategyInterface $strategy)

Adds a strategy.

The last strategy added is preffered over the other ones.
You can add a strategy twice ; when doing this, the first one is removed
when inserting the second one.

Parameters

FileStrategyInterface $strategy

Return Value

Zippy

at line 122
public array getStrategies()

Returns the strategies as they are stored

Return Value

array

at line 137
public AdapterInterface getAdapterFor(string $extension)

Returns an adapter for a file extension

Parameters

string $extension The extension

Return Value

AdapterInterface

Exceptions

FormatNotSupportedException When no strategy is defined for this extension
NoAdapterOnPlatformException When no adapter is supported for this extension on this platform

at line 161
static public Zippy load()

Creates Zippy and loads default strategies

Return Value

Zippy