PHP Class HM\BackUpWordPress\Excludes

Show file Open project: humanmade/backupwordpress Class Usage Examples

Public Methods

Method Description
__construct ( $excludes = [] )
get_default_excludes ( ) : array Get the array of default excludes.
get_excludes ( ) : array Get the excludes.
get_excludes_for_regex ( ) : array Get the excludes prepared for use with regex.
get_user_excludes ( ) : array Get the user defined excludes.
is_file_excluded ( SplFileInfo $file ) : boolean | null Check if a file is excluded, i.e. excluded directly or is in an excluded folder.
normalize ( array $excludes ) : array Normalise the exclude rules so they are ready to work with.
set_excludes ( string | array $excludes ) Set the exclude rules.

Method Details

__construct() public method

public __construct ( $excludes = [] )

get_default_excludes() public method

Get the array of default excludes.
public get_default_excludes ( ) : array
return array The array of excludes.

get_excludes() public method

Returns any user set excludes as well as the default list.
public get_excludes ( ) : array
return array The array of exclude rules.

get_excludes_for_regex() public method

The primary difference being that any wildcard (*) rules are converted to the regex fragment [\s\S]*?.
public get_excludes_for_regex ( ) : array
return array The array of exclude rules.

get_user_excludes() public method

Get the user defined excludes.
public get_user_excludes ( ) : array
return array The array of excludes.

is_file_excluded() public method

Check if a file is excluded, i.e. excluded directly or is in an excluded folder.
public is_file_excluded ( SplFileInfo $file ) : boolean | null
$file SplFileInfo File to check if it's excluded.
return boolean | null True if file is excluded, false otherwise. Null - if it's not a file.

normalize() public method

Normalise the exclude rules so they are ready to work with.
public normalize ( array $excludes ) : array
$excludes array The array of exclude rules to normalise.
return array The array of normalised rules.

set_excludes() public method

Excludes rules should be a complete or partial directory or file path. Wildcards can be specified with the * character.
public set_excludes ( string | array $excludes )
$excludes string | array The list of exclude rules, accepts either a comma separated list or an array.