Filter/File/Rename.php
LICENSE
This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Filter
- Version
- $Id: Rename.php 24593 2012-01-05 20:35:02Z matthew $
\Zend_Filter_File_Rename
- Implements
- \Zend_Filter_Interface
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Properties
Methods

__construct(string | array $options) : voidClass 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 sourcefile 'overwrite' => Shall existing files be overwritten ?
| Name | Type | Description |
|---|---|---|
| $options | string | array | Target file or directory to be renamed |

_convertOptions(array $options) : arrayInternal method for creating the file array Supports single and nested arrays
| Name | Type | Description |
|---|---|---|
| $options | array |
| Type | Description |
|---|---|
| array |

_getFileName(string $file) : arrayInternal method to resolve the requested source and return all other related parameters
| Name | Type | Description |
|---|---|---|
| $file | string | Filename to get the informations for |
| Type | Description |
|---|---|
| array |

addFile(string | array $options) : \Zend_Filter_File_RenameAdds 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 ?
| Name | Type | Description |
|---|---|---|
| $options | string | array | Old file or directory to be rewritten |
| Type | Description |
|---|---|
| \Zend_Filter_File_Rename |

filter(string $value) : stringDefined by Zend_Filter_Interface
Renames the file $value to the new name set before Returns the file $value, removing all but digit characters
| Name | Type | Description |
|---|---|---|
| $value | string | Full path of file to change |
| Type | Description |
|---|---|
| string | The new filename which has been set, or false when there were errors |
| Exception | Description |
|---|---|
| \Zend_Filter_Exception |

getFile() : arrayReturns the files to rename and their new name and location
| Type | Description |
|---|---|
| array |

getNewName(string $value, boolean $source = false) : stringReturns only the new filename without moving it But existing files will be erased when the overwrite option is true
| Name | Type | Description |
|---|---|---|
| $value | string | Full path of file to change |
| $source | boolean | Return internal informations |
| Type | Description |
|---|---|
| string | The new filename which has been set |

setFile(string | array $options) : \Zend_Filter_File_RenameSets 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 ?
| Name | Type | Description |
|---|---|---|
| $options | string | array | Old file or directory to be rewritten |
| Type | Description |
|---|---|
| \Zend_Filter_File_Rename |