BatchFileRenameOptions
└─BatchFileRenameOptionsRenameRules
public class BatchFileRenameOptionsRenameRules
extends BatchFileRenameOptions
Field Summary | |
---|---|
protected callback | Used to set the new file name using a user-defined callback, the callback must return a non-empty string value, otherwise the file will not be renamed. |
protected boolean | Used to capitalize the first character of the file name. |
protected string | Used to append extra extension to the file name of the renamed files. |
protected string | Used to set a fixed filename pattern for all renamed files. |
protected array | Used to insert a text to the file name at specific position. |
protected array | Case-insensitive version of the previous option "replace". |
protected boolean | Used to make the file extension lowercase. |
protected mixed | Used to set a new extension for the renamed files (could be a string or an array of file extensions). |
protected string | Used to add a prefix to the file name. |
protected array | Used to perform a regular expression search and replace within the file name. |
protected array | Used to remove specific characters from the file name. |
protected integer | Used to remove the first N of characters from the file name. |
protected integer | Used to remove the last N of characters from the file name. |
protected array | Used to remove a specific part from the file name indicated by the starting position and the length that will be removed. |
protected array | Used to remove specific words from the file name. |
protected array | Used to replace all occurrences of the search string with the replacement string wihthin the file name. |
protected string | Used to add a suffix to the file name. |
protected boolean | Used to convert the file name to camelCase. |
protected boolean | Used to make the file name to lowercase. |
protected boolean | Used to make the file name to uppercase. |
protected boolean | Used to make the file extension uppercase. |
Method Summary | |
---|---|
protected string | validateFixedFileName(string optionValue) Validates the 'fixedFileName' option. |
protected mixed | validateNewExtension(mixed optionValue) Validates the 'newExtension' option. |
protected string | validateExtraExtension(string optionValue) Validates the 'extraExtension' option. |
protected bool | validateUppercaseExtension(bool optionValue) Validates the 'uppercaseExtension' option. |
protected bool | validateLowercaseExtension(bool optionValue) Validates the 'lowercaseExtension' option. |
protected array | validateRemoveChars(array optionValue) Validates the 'removeChars' option. |
protected array | validateRemoveWords(array optionValue) Validates the 'removeWords' option. |
protected integer | validateRemoveFromLeft(integer optionValue) Validates the 'removeFromLeft' option. |
protected integer | validateRemoveFromRight(integer optionValue) Validates the 'removeFromRight' option. |
protected array | validateRemoveLength(array optionValue) Validates the 'removeLength' option. |
protected string | validatePrefix(string optionValue) Validates the 'prefix' option. |
protected string | validateSuffix(string optionValue) Validates the 'suffix' option. |
protected array | validateInsert(array optionValue) Validates the 'insert' option. |
protected array | validateReplaceOptions(string optionName, array optionValue) Validates the 'replace', 'ireplace' and 'regex' options. |
protected array | validateReplace(array optionValue) Validates the 'replace' option. |
protected array | validateIreplace(array optionValue) Validates the 'ireplace' option. |
protected array | validateRegex(array optionValue) Validates the 'regex' option. |
protected bool | validateToUppercase(bool optionValue) Validates the 'toUppercase' option. |
protected bool | validateToLowercase(bool optionValue) Validates the 'toLowercase' option. |
protected bool | validateToCamelCase(bool optionValue) Validates the 'toCamelCase' option. |
protected bool | validateCapitalizeFirst(bool optionValue) Validates the 'capitalizeFirst' option. |
Methods inherited from BatchFileRename\BatchFileRenameOptions | |
---|---|
__construct, getOption, getOptions, hasValue, isEmptyString, isOption, setOption, setOptions, validateBoolean, validateCallback, validateString |
protected callback $callback
Used to set the new file name using a user-defined callback, the callback must return a non-empty string value, otherwise the file will not be renamed.
The callback takes only two paramaters:
the second is an object contains the new file information that was set according the defined renaming rules
# Example values function myCustomCallback($fileinfo, $renameinfo){ return $renameinfo->name; }
# Default value
NULL
protected boolean $capitalizeFirst
Used to capitalize the first character of the file name.
false
protected string $extraExtension
Used to append extra extension to the file name of the renamed files.
NULL
protected string $fixedFileName
Used to set a fixed filename pattern for all renamed files.
NULL
protected array $insert
Used to insert a text to the file name at specific position.
NULL
protected array $ireplace
Case-insensitive version of the previous option "replace".
NULL
protected boolean $lowercaseExtension
Used to make the file extension lowercase.
false
protected mixed $newExtension
Used to set a new extension for the renamed files (could be a string or an array of file extensions).
# Example values txt changes the extension of the renamed files to 'txt' array('html' => 'txt', 'png' => 'jpeg') changes the extension of the html files to 'txt' and png files to 'jpeg'
# Default value NULL
protected string $prefix
Used to add a prefix to the file name.
NULL
protected array $regex
Used to perform a regular expression search and replace within the file name.
NULL
protected array $removeChars
Used to remove specific characters from the file name.
NULL
protected integer $removeFromLeft
Used to remove the first N of characters from the file name.
0
protected integer $removeFromRight
Used to remove the last N of characters from the file name.
0
protected array $removeLength
Used to remove a specific part from the file name indicated by the starting position and the length that will be removed.
NULL
protected array $removeWords
Used to remove specific words from the file name.
NULL
protected array $replace
Used to replace all occurrences of the search string with the replacement string wihthin the file name.
NULL
protected string $suffix
Used to add a suffix to the file name.
NULL
protected boolean $toCamelCase
Used to convert the file name to camelCase.
false
protected boolean $toLowercase
Used to make the file name to lowercase.
false
protected boolean $toUppercase
Used to make the file name to uppercase.
false
protected boolean $uppercaseExtension
Used to make the file extension uppercase.
false
protected string validateFixedFileName(string optionValue)
Validates the 'fixedFileName' option.
protected mixed validateNewExtension(mixed optionValue)
Validates the 'newExtension' option.
protected string validateExtraExtension(string optionValue)
Validates the 'extraExtension' option.
protected bool validateUppercaseExtension(bool optionValue)
Validates the 'uppercaseExtension' option.
protected bool validateLowercaseExtension(bool optionValue)
Validates the 'lowercaseExtension' option.
protected array validateRemoveChars(array optionValue)
Validates the 'removeChars' option.
protected array validateRemoveWords(array optionValue)
Validates the 'removeWords' option.
protected integer validateRemoveFromLeft(integer optionValue)
Validates the 'removeFromLeft' option.
protected integer validateRemoveFromRight(integer optionValue)
Validates the 'removeFromRight' option.
protected array validateRemoveLength(array optionValue)
Validates the 'removeLength' option.
protected string validatePrefix(string optionValue)
Validates the 'prefix' option.
protected string validateSuffix(string optionValue)
Validates the 'suffix' option.
protected array validateInsert(array optionValue)
Validates the 'insert' option.
protected array validateReplaceOptions(string optionName, array optionValue)
Validates the 'replace', 'ireplace' and 'regex' options.
protected array validateReplace(array optionValue)
Validates the 'replace' option.
protected array validateIreplace(array optionValue)
Validates the 'ireplace' option.
protected array validateRegex(array optionValue)
Validates the 'regex' option.
protected bool validateToUppercase(bool optionValue)
Validates the 'toUppercase' option.
protected bool validateToLowercase(bool optionValue)
Validates the 'toLowercase' option.
protected bool validateToCamelCase(bool optionValue)
Validates the 'toCamelCase' option.
protected bool validateCapitalizeFirst(bool optionValue)
Validates the 'capitalizeFirst' option.
Controles the renaming rules according wich the files will be renamed.