668. Class

668.1. Zend\Filter\File\Rename

668.1.1. Methods

668.1.1.1. __construct

__construct()

Class constructor

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:string|array|Traversable – Target file or directory to be renamed
Throws ExceptionInvalidArgumentException:
 

668.1.1.2. getFile

getFile()

Returns the files to rename and their new name and location

Return type:array

668.1.1.3. setFile

setFile()

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

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:string|array – Old file or directory to be rewritten
Return type:ZendFilterFileRename

668.1.1.4. addFile

addFile()

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

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:string|array – Old file or directory to be rewritten
Return type:Rename
Throws :ExceptionInvalidArgumentException

668.1.1.5. getNewName

getNewName()

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

Parameters:
  • string – Full path of file to change
  • bool – Return internal informations
Return type:

string The new filename which has been set

Throws :

ExceptionInvalidArgumentException If the target file already exists.

668.1.1.6. filter

filter()

Defined by ZendFilterFilter

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

Parameters:string|array – Full path of file to change or $_FILES data array
Throws ExceptionRuntimeException:
 
Return type:string|array The new filename which has been set

668.1.1.7. _convertOptions

_convertOptions()

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

Parameters:array
Return type:array

668.1.1.8. _getFileName

_getFileName()

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

Parameters:string – Filename to get the informations for
Return type:array|string