BatchFileRename Libraryv1.0

BatchFileRenameOptions.php at line 661

Class BatchFileRenameOptionsRenameRules

BatchFileRenameOptions
└─BatchFileRenameOptionsRenameRules

public class BatchFileRenameOptionsRenameRules
extends BatchFileRenameOptions

Controles the renaming rules according wich the files will be renamed.

Author:
Mohamed ELkholy
License:
LGPL
Since:
Release: 1.0

Field Summary
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.

protected boolean

$capitalizeFirst

Used to capitalize the first character of the file name.

protected string

$extraExtension

Used to append extra extension to the file name of the renamed files.

protected string

$fixedFileName

Used to set a fixed filename pattern for all renamed files.

protected array

$insert

Used to insert a text to the file name at specific position.

protected array

$ireplace

Case-insensitive version of the previous option "replace".

protected boolean

$lowercaseExtension

Used to make the file extension lowercase.

protected mixed

$newExtension

Used to set a new extension for the renamed files (could be a string or an array of file extensions).

protected string

$prefix

Used to add a prefix to the file name.

protected array

$regex

Used to perform a regular expression search and replace within the file name.

protected array

$removeChars

Used to remove specific characters from the file name.

protected integer

$removeFromLeft

Used to remove the first N of characters from the file name.

protected integer

$removeFromRight

Used to remove the last N of characters from the file name.

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.

protected array

$removeWords

Used to remove specific words from the file name.

protected array

$replace

Used to replace all occurrences of the search string with the replacement string wihthin the file name.

protected string

$suffix

Used to add a suffix to the file name.

protected boolean

$toCamelCase

Used to convert the file name to camelCase.

protected boolean

$toLowercase

Used to make the file name to lowercase.

protected boolean

$toUppercase

Used to make the file name to uppercase.

protected boolean

$uppercaseExtension

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

Field Detail

BatchFileRenameOptions.php at line 987

callback

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:

NULL


BatchFileRenameOptions.php at line 967

capitalizeFirst

protected boolean $capitalizeFirst

Used to capitalize the first character of the file name.

false


BatchFileRenameOptions.php at line 705

extraExtension

protected string $extraExtension

Used to append extra extension to the file name of the renamed files.

NULL


BatchFileRenameOptions.php at line 675

fixedFileName

protected string $fixedFileName

Used to set a fixed filename pattern for all renamed files.

NULL


BatchFileRenameOptions.php at line 854

insert

protected array $insert

Used to insert a text to the file name at specific position.

NULL


BatchFileRenameOptions.php at line 891

ireplace

protected array $ireplace

Case-insensitive version of the previous option "replace".

NULL

See Also:
http://www.php.net/manual/en/function.str_ireplace.php

BatchFileRenameOptions.php at line 733

lowercaseExtension

protected boolean $lowercaseExtension

Used to make the file extension lowercase.

false


BatchFileRenameOptions.php at line 691

newExtension

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


BatchFileRenameOptions.php at line 825

prefix

protected string $prefix

Used to add a prefix to the file name.

NULL


BatchFileRenameOptions.php at line 911

regex

protected array $regex

Used to perform a regular expression search and replace within the file name.

NULL

See Also:
http://www.php.net/manual/en/function.preg_replace.php

BatchFileRenameOptions.php at line 749

removeChars

protected array $removeChars

Used to remove specific characters from the file name.

NULL


BatchFileRenameOptions.php at line 780

removeFromLeft

protected integer $removeFromLeft

Used to remove the first N of characters from the file name.

0


BatchFileRenameOptions.php at line 795

removeFromRight

protected integer $removeFromRight

Used to remove the last N of characters from the file name.

0


BatchFileRenameOptions.php at line 811

removeLength

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


BatchFileRenameOptions.php at line 765

removeWords

protected array $removeWords

Used to remove specific words from the file name.

NULL


BatchFileRenameOptions.php at line 876

replace

protected array $replace

Used to replace all occurrences of the search string with the replacement string wihthin the file name.

NULL

See Also:
http://www.php.net/manual/en/function.str_replace.php

BatchFileRenameOptions.php at line 839

suffix

protected string $suffix

Used to add a suffix to the file name.

NULL


BatchFileRenameOptions.php at line 953

toCamelCase

protected boolean $toCamelCase

Used to convert the file name to camelCase.

false


BatchFileRenameOptions.php at line 939

toLowercase

protected boolean $toLowercase

Used to make the file name to lowercase.

false


BatchFileRenameOptions.php at line 925

toUppercase

protected boolean $toUppercase

Used to make the file name to uppercase.

false


BatchFileRenameOptions.php at line 719

uppercaseExtension

protected boolean $uppercaseExtension

Used to make the file extension uppercase.

false


Method Detail

BatchFileRenameOptions.php at line 997

validateFixedFileName

protected string validateFixedFileName(string optionValue)

Validates the 'fixedFileName' option.

Throws:
InvalidArgumentException - if the supplied paramater is not a valid string

BatchFileRenameOptions.php at line 1018

validateNewExtension

protected mixed validateNewExtension(mixed optionValue)

Validates the 'newExtension' option.

Throws:
InvalidArgumentException - if the supplied paramater is not a valid string or array

BatchFileRenameOptions.php at line 1041

validateExtraExtension

protected string validateExtraExtension(string optionValue)

Validates the 'extraExtension' option.

Throws:
InvalidArgumentException - if the supplied paramater is not a valid string

BatchFileRenameOptions.php at line 1062

validateUppercaseExtension

protected bool validateUppercaseExtension(bool optionValue)

Validates the 'uppercaseExtension' option.

Throws:
InvalidArgumentException - if the supplied paramater is not a valid boolean value

BatchFileRenameOptions.php at line 1079

validateLowercaseExtension

protected bool validateLowercaseExtension(bool optionValue)

Validates the 'lowercaseExtension' option.

Throws:
InvalidArgumentException - if the supplied paramater is not a valid boolean value

BatchFileRenameOptions.php at line 1096

validateRemoveChars

protected array validateRemoveChars(array optionValue)

Validates the 'removeChars' option.

Throws:
InvalidArgumentException - if the supplied paramater is not a valid array

BatchFileRenameOptions.php at line 1113

validateRemoveWords

protected array validateRemoveWords(array optionValue)

Validates the 'removeWords' option.

Throws:
InvalidArgumentException - if the supplied paramater is not a valid array

BatchFileRenameOptions.php at line 1130

validateRemoveFromLeft

protected integer validateRemoveFromLeft(integer optionValue)

Validates the 'removeFromLeft' option.

Throws:
InvalidArgumentException - if the supplied paramater is not a number

BatchFileRenameOptions.php at line 1147

validateRemoveFromRight

protected integer validateRemoveFromRight(integer optionValue)

Validates the 'removeFromRight' option.

Throws:
InvalidArgumentException - if the supplied paramater is not a number

BatchFileRenameOptions.php at line 1164

validateRemoveLength

protected array validateRemoveLength(array optionValue)

Validates the 'removeLength' option.

Throws:
InvalidArgumentException - if the supplied paramater is not a valid array of two numeric values

BatchFileRenameOptions.php at line 1184

validatePrefix

protected string validatePrefix(string optionValue)

Validates the 'prefix' option.

Throws:
InvalidArgumentException - if the supplied paramater is not a valid string

BatchFileRenameOptions.php at line 1205

validateSuffix

protected string validateSuffix(string optionValue)

Validates the 'suffix' option.

Throws:
InvalidArgumentException - if the supplied paramater is not a valid string

BatchFileRenameOptions.php at line 1226

validateInsert

protected array validateInsert(array optionValue)

Validates the 'insert' option.

Throws:
InvalidArgumentException - if the supplied paramater is not a valid array of two values, the first value is a string and the second is a number

BatchFileRenameOptions.php at line 1250

validateReplaceOptions

protected array validateReplaceOptions(string optionName, array optionValue)

Validates the 'replace', 'ireplace' and 'regex' options.

Throws:
InvalidArgumentException - if the supplied paramater is not a valid array of two array or string values

BatchFileRenameOptions.php at line 1278

validateReplace

protected array validateReplace(array optionValue)

Validates the 'replace' option.

Throws:
InvalidArgumentException

BatchFileRenameOptions.php at line 1291

validateIreplace

protected array validateIreplace(array optionValue)

Validates the 'ireplace' option.

Throws:
InvalidArgumentException

BatchFileRenameOptions.php at line 1304

validateRegex

protected array validateRegex(array optionValue)

Validates the 'regex' option.

Throws:
InvalidArgumentException

BatchFileRenameOptions.php at line 1317

validateToUppercase

protected bool validateToUppercase(bool optionValue)

Validates the 'toUppercase' option.

Throws:
InvalidArgumentException - if the supplied paramater is not a valid boolean value

BatchFileRenameOptions.php at line 1334

validateToLowercase

protected bool validateToLowercase(bool optionValue)

Validates the 'toLowercase' option.

Throws:
InvalidArgumentException - if the supplied paramater is not a valid boolean value

BatchFileRenameOptions.php at line 1351

validateToCamelCase

protected bool validateToCamelCase(bool optionValue)

Validates the 'toCamelCase' option.

Throws:
InvalidArgumentException - if the supplied paramater is not a valid boolean value

BatchFileRenameOptions.php at line 1368

validateCapitalizeFirst

protected bool validateCapitalizeFirst(bool optionValue)

Validates the 'capitalizeFirst' option.

Throws:
InvalidArgumentException - if the supplied paramater is not a valid boolean value