[ Index ]

PHP Cross Reference of phpBB-3.2.11-deutsch

title

Body

[close]

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

(no description)

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

Defines 1 class

Finder:: (41 methods):
  __construct()
  create()
  addAdapter()
  useBestAdapter()
  setAdapter()
  removeAdapters()
  getAdapters()
  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()
  count()
  sortAdapters()
  searchInDirectory()
  buildAdapter()
  resetAdapterSelection()
  initDefaultAdapters()
  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 easy chaining:

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

__construct()   X-Ref
No description

create()   X-Ref
Creates a new Finder.

return: static

addAdapter(AdapterInterface $adapter, $priority = 0)   X-Ref
Registers a finder engine implementation.

param: AdapterInterface $adapter  An adapter instance
param: int              $priority Highest is selected first
return: $this

useBestAdapter()   X-Ref
Sets the selected adapter to the best one according to the current platform the code is run on.

return: $this

setAdapter($name)   X-Ref
Selects the adapter to use.

param: string $name
return: $this

removeAdapters()   X-Ref
Removes all adapters registered in the finder.

return: $this

getAdapters()   X-Ref
Returns registered adapters ordered by priority without extra information.

return: AdapterInterface[]

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.

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

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');

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

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')

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

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

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

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')

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

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')

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

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.

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

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.

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

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

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

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

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');

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

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

This option is enabled by default.

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

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

This option is enabled by default.

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

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.

param: bool $ignore
return: $this

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

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

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.

param: iterable $iterator
return: $this

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

return: int

sortAdapters()   X-Ref

return: $this

searchInDirectory($dir)   X-Ref

param: string $dir
return: \Iterator

buildAdapter(AdapterInterface $adapter)   X-Ref

return: AdapterInterface

resetAdapterSelection()   X-Ref
Unselects all adapters.


initDefaultAdapters()   X-Ref
No description

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

param: string $dir
return: string



Generated: Wed Nov 11 20:33:01 2020 Cross-referenced by PHPXref 0.7.1