[ Index ]

PHP Cross Reference of phpBB-3.3.12-deutsch

title

Body

[close]

/vendor/symfony/finder/ -> Finder.php (summary)

(no description)

File Size: 759 lines (20 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Finder:: (33 methods):
  __construct()
  create()
  directories()
  files()
  depth()
  date()
  name()
  notName()
  contains()
  notContains()
  path()
  notPath()
  size()
  exclude()
  ignoreDotFiles()
  ignoreVCS()
  addVCSPattern()
  sort()
  sortByName()
  sortByType()
  sortByAccessedTime()
  sortByChangedTime()
  sortByModifiedTime()
  filter()
  followLinks()
  ignoreUnreadableDirs()
  in()
  getIterator()
  append()
  hasResults()
  count()
  searchInDirectory()
  normalizeDir()


Class: Finder  - X-Ref

Finder allows to build rules to find files and directories.

It is a thin wrapper around several specialized iterator classes.

All rules may be invoked several times.

All methods return the current Finder object to allow chaining:

$finder = Finder::create()->files()->name('*.php')->in(__DIR__);

__construct()   X-Ref
No description

create()   X-Ref
Creates a new Finder.

return: static

directories()   X-Ref
Restricts the matching to directories only.

return: $this

files()   X-Ref
Restricts the matching to files only.

return: $this

depth($level)   X-Ref
Adds tests for the directory depth.

Usage:

$finder->depth('> 1') // the Finder will start matching at level 1.
$finder->depth('< 3') // the Finder will descend at most 3 levels of directories below the starting point.

return: $this
param: string|int $level The depth level expression

date($date)   X-Ref
Adds tests for file dates (last modified).

The date must be something that strtotime() is able to parse:

$finder->date('since yesterday');
$finder->date('until 2 days ago');
$finder->date('> now - 2 hours');
$finder->date('>= 2005-10-15');

return: $this
param: string $date A date range string

name($pattern)   X-Ref
Adds rules that files must match.

You can use patterns (delimited with / sign), globs or simple strings.

$finder->name('*.php')
$finder->name('/\.php$/') // same as above
$finder->name('test.php')

return: $this
param: string $pattern A pattern (a regexp, a glob, or a string)

notName($pattern)   X-Ref
Adds rules that files must not match.

return: $this
param: string $pattern A pattern (a regexp, a glob, or a string)

contains($pattern)   X-Ref
Adds tests that file contents must match.

Strings or PCRE patterns can be used:

$finder->contains('Lorem ipsum')
$finder->contains('/Lorem ipsum/i')

return: $this
param: string $pattern A pattern (string or regexp)

notContains($pattern)   X-Ref
Adds tests that file contents must not match.

Strings or PCRE patterns can be used:

$finder->notContains('Lorem ipsum')
$finder->notContains('/Lorem ipsum/i')

return: $this
param: string $pattern A pattern (string or regexp)

path($pattern)   X-Ref
Adds rules that filenames must match.

You can use patterns (delimited with / sign) or simple strings.

$finder->path('some/special/dir')
$finder->path('/some\/special\/dir/') // same as above

Use only / as dirname separator.

return: $this
param: string $pattern A pattern (a regexp or a string)

notPath($pattern)   X-Ref
Adds rules that filenames must not match.

You can use patterns (delimited with / sign) or simple strings.

$finder->notPath('some/special/dir')
$finder->notPath('/some\/special\/dir/') // same as above

Use only / as dirname separator.

return: $this
param: string $pattern A pattern (a regexp or a string)

size($size)   X-Ref
Adds tests for file sizes.

$finder->size('> 10K');
$finder->size('<= 1Ki');
$finder->size(4);

return: $this
param: string|int $size A size range string or an integer

exclude($dirs)   X-Ref
Excludes directories.

Directories passed as argument must be relative to the ones defined with the `in()` method. For example:

$finder->in(__DIR__)->exclude('ruby');

return: $this
param: string|array $dirs A directory path or an array of directories

ignoreDotFiles($ignoreDotFiles)   X-Ref
Excludes "hidden" directories and files (starting with a dot).

This option is enabled by default.

return: $this
param: bool $ignoreDotFiles Whether to exclude "hidden" files or not

ignoreVCS($ignoreVCS)   X-Ref
Forces the finder to ignore version control directories.

This option is enabled by default.

return: $this
param: bool $ignoreVCS Whether to exclude VCS files or not

addVCSPattern($pattern)   X-Ref
Adds VCS patterns.

param: string|string[] $pattern VCS patterns to ignore

sort(\Closure $closure)   X-Ref
Sorts files and directories by an anonymous function.

The anonymous function receives two \SplFileInfo instances to compare.

This can be slow as all the matching files and directories must be retrieved for comparison.

return: $this

sortByName()   X-Ref
Sorts files and directories by name.

This can be slow as all the matching files and directories must be retrieved for comparison.

return: $this

sortByType()   X-Ref
Sorts files and directories by type (directories before files), then by name.

This can be slow as all the matching files and directories must be retrieved for comparison.

return: $this

sortByAccessedTime()   X-Ref
Sorts files and directories by the last accessed time.

This is the time that the file was last accessed, read or written to.

This can be slow as all the matching files and directories must be retrieved for comparison.

return: $this

sortByChangedTime()   X-Ref
Sorts files and directories by the last inode changed time.

This is the time that the inode information was last modified (permissions, owner, group or other metadata).

On Windows, since inode is not available, changed time is actually the file creation time.

This can be slow as all the matching files and directories must be retrieved for comparison.

return: $this

sortByModifiedTime()   X-Ref
Sorts files and directories by the last modified time.

This is the last time the actual contents of the file were last modified.

This can be slow as all the matching files and directories must be retrieved for comparison.

return: $this

filter(\Closure $closure)   X-Ref
Filters the iterator with an anonymous function.

The anonymous function receives a \SplFileInfo and must return false
to remove files.

return: $this

followLinks()   X-Ref
Forces the following of symlinks.

return: $this

ignoreUnreadableDirs($ignore = true)   X-Ref
Tells finder to ignore unreadable directories.

By default, scanning unreadable directories content throws an AccessDeniedException.

return: $this
param: bool $ignore

in($dirs)   X-Ref
Searches files and directories which match defined rules.

return: $this
param: string|string[] $dirs A directory path or an array of directories

getIterator()   X-Ref
Returns an Iterator for the current Finder configuration.

This method implements the IteratorAggregate interface.

return: \Iterator|SplFileInfo[] An iterator

append($iterator)   X-Ref
Appends an existing set of files/directories to the finder.

The set can be another Finder, an Iterator, an IteratorAggregate, or even a plain array.

return: $this
param: iterable $iterator

hasResults()   X-Ref
Check if any results were found.

return: bool

count()   X-Ref
Counts all the results collected by the iterators.

return: int

searchInDirectory($dir)   X-Ref

return: \Iterator
param: string $dir

normalizeDir($dir)   X-Ref
Normalizes given directory names by removing trailing slashes.

Excluding: (s)ftp:// or ssh2.(s)ftp:// wrapper

return: string
param: string $dir



Generated: Sun Jun 23 12:25:44 2024 Cross-referenced by PHPXref 0.7.1