types/selectors/SelectorUtils.php

Show: inherited
Table of Contents

<p>This is a utility class used by selectors and DirectoryScanner. The functionality more properly belongs just to selectors, but unfortunately DirectoryScanner exposed these as protected methods. Thus we have to support any subclasses of DirectoryScanner that may access these methods.

This is a Singleton.

Author
Hans Lellelid, hans@xmpl.org (Phing)  
Author
Arnout J. Kuiper, ajkuiper@wxs.nl (Ant)  
Author
Magesh Umasankar  
Author
Bruce Atherton, bruce@callenish.com (Ant)  
Package
phing.types.selectors  

\SelectorUtils

Package: phing\types\selectors

<p>This is a utility class used by selectors and DirectoryScanner. The functionality more properly belongs just to selectors, but unfortunately DirectoryScanner exposed these as protected methods. Thus we have to support any subclasses of DirectoryScanner that may access these methods.

This is a Singleton.

Author
Hans Lellelid, hans@xmpl.org (Phing)  
Author
Arnout J. Kuiper, ajkuiper@wxs.nl (Ant)  
Author
Magesh Umasankar  
Author
Bruce Atherton, bruce@callenish.com (Ant)  

Properties

Propertyprivate  $instance= ''
static
Details
Type
n/a

Methods

methodpublicgetInstance( ) : void
static

Retrieves the instance of the Singleton.

methodpublicisOutOfDate( \PhingFile $src, \PhingFile $target, int $granularity ) : \whether
static

Returns dependency information on these two files. If src has been modified later than target, it returns true. If target doesn't exist, it likewise returns true. Otherwise, target is newer than src and is not out of date, thus the method returns false. It also returns false if the src file doesn't even exist, since how could the target then be out of date.

Parameters
Name Type Description
$src \PhingFile

the original file

$target \PhingFile

the file being compared against

$granularity int

the amount in seconds of slack we will give in determining out of dateness

Returns
Type Description
\whether the target is out of date
methodpublicmatch( \pattern $pattern, \str $str, \isCaseSensitive $isCaseSensitive = true ) : \<code>true</code>
static

Tests whether or not a string matches against a pattern.

The pattern may contain two special characters:
'*' means zero or more characters
'?' means one and only one character

Parameters
Name Type Description
$pattern \pattern

The pattern to match against. Must not be null.

$str \str

The string which must be matched against the pattern. Must not be null.

$isCaseSensitive \isCaseSensitive

Whether or not matching should be performed case sensitively.

Returns
Type Description
\<code>true</code> if the string matches against the pattern, or <code>false</code> otherwise.
methodpublicmatchPath( \pattern $pattern, \str $str, \isCaseSensitive $isCaseSensitive = true ) : \<code>true</code>
static

Tests whether or not a given path matches a given pattern.

Parameters
Name Type Description
$pattern \pattern

The pattern to match against. Must not be null.

$str \str

The path to match, as a String. Must not be null.

$isCaseSensitive \isCaseSensitive

Whether or not matching should be performed case sensitively.

Returns
Type Description
\<code>true</code> if the pattern matches against the string, or <code>false</code> otherwise.
methodpublicmatchPatternStart( \pattern $pattern, \str $str, \isCaseSensitive $isCaseSensitive = true ) : \whether
static

Tests whether or not a given path matches the start of a given pattern up to the first "**".

<

p> This is not a general purpose test and should only be used if you can live with false positives. For example,

pattern=**\a

and

str=b

will yield

true

.

Parameters
Name Type Description
$pattern \pattern

The pattern to match against. Must not be null.

$str \str

The path to match, as a String. Must not be null.

$isCaseSensitive \isCaseSensitive

Whether or not matching should be performed case sensitively.

Returns
Type Description
\whether or not a given path matches the start of a given pattern up to the first "**".
Documentation was generated by DocBlox 0.18.1.