Documentation

FileList
in package

Table of Contents

$fileIterator  : DirectoryIterator
Recursive directory iterator.
$rootPath  : string
The path to the project root directory.
$baseRegex  : string
Base regex to use if no filter regex is provided.
__construct()  : mixed
Constructor.
getList()  : array<string|int, mixed>
Retrieve the filtered file list as an array.

Properties

$fileIterator

Recursive directory iterator.

public DirectoryIterator $fileIterator

$rootPath

The path to the project root directory.

protected string $rootPath

$baseRegex

Base regex to use if no filter regex is provided.

private string $baseRegex = '`^%s(?!\.git/)(?!(.*/)?\.+$)(?!.*\.(bak|orig)).*$`Dix'

Matches based on:

  • File path starts with the project root (replacement done in constructor).
  • Don't match .git/ files.
  • Don't match dot files, i.e. "." or "..".
  • Don't match backup files.
  • Match everything else in a case-insensitive manner.

Methods

__construct()

Constructor.

public __construct(string $directory[, string $rootPath = '' ][, string $filter = '' ]) : mixed
Parameters
$directory : string

The directory to examine.

$rootPath : string = ''

Path to the project root.

$filter : string = ''

PCRE regular expression to filter the file list with.

Return values
mixed

getList()

Retrieve the filtered file list as an array.

public getList() : array<string|int, mixed>
Return values
array<string|int, mixed>

Search results