Methods

Class constructor

__construct(string | array | \Traversable $options) 

Options argument may be either a string, a Zend_Config object, or an array. If an array or Zend_Config object, it accepts the following keys: 'source' => Source filename or directory which will be renamed 'target' => Target filename or directory, the new name of the source file 'overwrite' => Shall existing files be overwritten ? 'randomize' => Shall target files have a random postfix attached?

Parameters

$options

stringarray\Traversable

Target file or directory to be renamed

Exceptions

\Zend\Filter\Exception\InvalidArgumentException

Invoke filter as a command

__invoke(mixed $value) : mixed
Inherited

Proxies to filter()

inherited_from \Zend\Filter\AbstractFilter::__invoke()

Parameters

$value

mixed

Exceptions

\Zend\Filter\Exception\ExceptionInterface If filtering $value is impossible

Returns

mixed

Adds a new file or directory as target to the existing ones

addFile(string | array $options) : \Zend\Filter\File\Rename

Array accepts the following keys: 'source' => Source filename or directory which will be renamed 'target' => Target filename or directory, the new name of the sourcefile 'overwrite' => Shall existing files be overwritten? 'randomize' => Shall target files have a random postfix attached?

Parameters

$options

stringarray

Old file or directory to be rewritten

Exceptions

\Zend\Filter\Exception\InvalidArgumentException

Returns

Defined by Zend\Filter\Filter

filter(string | array $value) : string | array

Renames the file $value to the new name set before Returns the file $value, removing all but digit characters

Parameters

$value

stringarray

Full path of file to change or $_FILES data array

Exceptions

\Zend\Filter\Exception\RuntimeException

Returns

stringarrayThe new filename which has been set

Returns the files to rename and their new name and location

getFile() : array

Returns

array

Returns only the new filename without moving it But existing files will be erased when the overwrite option is true

getNewName(string $value, bool $source) : string

Parameters

$value

string

Full path of file to change

$source

bool

Return internal informations

Exceptions

\Zend\Filter\Exception\InvalidArgumentException If the target file already exists.

Returns

stringThe new filename which has been set

Retrieve options representing object state

getOptions() : array
Inherited

inherited_from \Zend\Filter\AbstractFilter::getOptions()

Returns

array

hasPcreUnicodeSupport()

hasPcreUnicodeSupport() : bool
Inherited

inherited_from \Zend\Filter\AbstractFilter::hasPcreUnicodeSupport()

Returns

bool

Sets a new file or directory as target, deleting existing ones

setFile(string | array $options) : \Zend\Filter\File\Rename

Array accepts the following keys: 'source' => Source filename or directory which will be renamed 'target' => Target filename or directory, the new name of the sourcefile 'overwrite' => Shall existing files be overwritten? 'randomize' => Shall target files have a random postfix attached?

Parameters

$options

stringarray

Old file or directory to be rewritten

Returns

setOptions()

setOptions(array | \Traversable $options) : \Zend\Filter\AbstractFilter
Inherited

inherited_from \Zend\Filter\AbstractFilter::setOptions()

Parameters

$options

array\Traversable

Exceptions

\Zend\Filter\Exception\InvalidArgumentException

Returns

Internal method for creating the file array Supports single and nested arrays

_convertOptions(array $options) : array

Parameters

$options

array

Returns

array

Internal method to resolve the requested source and return all other related parameters

_getFileName(string $file) : array | string

Parameters

$file

string

Filename to get the informations for

Returns

arraystring

isOptions()

isOptions(mixed $options) : bool
Inherited

inherited_from \Zend\Filter\AbstractFilter::isOptions()

Parameters

$options

mixed

Returns

bool

 Properties

 

Internal array of array(source, target, overwrite)

$files 

 

Filter options

$options : array
Inherited

inherited_from \Zend\Filter\AbstractFilter::$$options