class PhockitoClassManifestUpdater extends SS_ClassManifest (View source)

Constants

CONF_FILE

CONF_DIR

Properties

protected $base from  SS_ClassManifest
protected $tests from  SS_ClassManifest
protected $cache from  SS_ClassManifest
protected $cacheKey from  SS_ClassManifest
protected $classes from  SS_ClassManifest
protected $roots from  SS_ClassManifest
protected $children from  SS_ClassManifest
protected $descendants from  SS_ClassManifest
protected $interfaces from  SS_ClassManifest
protected $implementors from  SS_ClassManifest
protected $configs from  SS_ClassManifest
protected $configDirs from  SS_ClassManifest

Methods

public static 
get_class_parser()

No description

public static 
get_namespace_parser()

No description

public static 
get_interface_parser()

No description

public static 
get_imported_namespace_parser()

Create a TokenisedRegularExpression that extracts the namespaces imported with the 'use' keyword

public
__construct($manifest)

Constructs and initialises a new class manifest, either loading the data from the cache or re-scanning for classes.

public
string|null
getItemPath(string $name)

Returns the file path to a class or interface if it exists in the manifest.

public
array
getClasses()

Returns a map of lowercased class names to file paths.

public
array
getClassNames()

Returns a lowercase array of all the class names in the manifest.

public
array
getDescendants()

Returns an array of all the descendant data.

public
array
getDescendantsOf(string|object $class)

Returns an array containing all the descendants (direct and indirect) of a class.

public
array
getInterfaces()

Returns a map of lowercased interface names to file locations.

public
array
getImplementors()

Returns a map of lowercased interface names to the classes the implement them.

public
array
getImplementorsOf(string $interface)

Returns an array containing the class names that implement a certain interface.

public
array
getConfigs()

Returns an array of paths to module config files.

public
array
getModules()

Returns an array of module names mapped to their paths.

protected
setDefaults()

Used to set up files that we want to exclude from parsing for performance reasons.

public
regenerate(bool $cache = true)

Completely regenerates the manifest file.

public
handleDir($basename, $pathname, $depth)

No description

protected
string
findClassOrInterfaceFromCandidateImports(string $class, string $namespace = '', array $imports = array())

Find a the full namespaced declaration of a class (or interface) from a list of candidate imports

protected
array
getImportsFromTokens(array $tokens)

Return an array of array($alias => $import) from tokenizer's tokens of a PHP file

public
handleFile($basename, $pathname, $depth)

No description

protected
array
coalesceDescendants(string $class)

Recursively coalesces direct child information into full descendant information.

public
addDouble($double, $doubled, $isInterface = false)

No description

public static 
register_double(string $double, string $of, bool $isDoubleOfInterface = false)

The callback that Phockito will call every time there's a new double created

Details

static TokenisedRegularExpression get_class_parser()

No description

static TokenisedRegularExpression get_namespaced_class_parser()

No description

static TokenisedRegularExpression get_namespace_parser()

No description

static TokenisedRegularExpression get_interface_parser()

No description

static TokenisedRegularExpression get_imported_namespace_parser()

Create a TokenisedRegularExpression that extracts the namespaces imported with the 'use' keyword

This searches symbols for a use followed by 1 or more namespaces which are optionally aliased using the as keyword. The relevant matching tokens are added one-by-one into an array (using save_to param).

eg: use Namespace\ClassName as Alias, OtherNamespace\ClassName;

__construct($manifest)

Constructs and initialises a new class manifest, either loading the data from the cache or re-scanning for classes.

Parameters

$manifest

string|null getItemPath(string $name)

Returns the file path to a class or interface if it exists in the manifest.

Parameters

string $name

Return Value

string|null

array getClasses()

Returns a map of lowercased class names to file paths.

Return Value

array

array getClassNames()

Returns a lowercase array of all the class names in the manifest.

Return Value

array

array getDescendants()

Returns an array of all the descendant data.

Return Value

array

array getDescendantsOf(string|object $class)

Returns an array containing all the descendants (direct and indirect) of a class.

Parameters

string|object $class

Return Value

array

array getInterfaces()

Returns a map of lowercased interface names to file locations.

Return Value

array

array getImplementors()

Returns a map of lowercased interface names to the classes the implement them.

Return Value

array

array getImplementorsOf(string $interface)

Returns an array containing the class names that implement a certain interface.

Parameters

string $interface

Return Value

array

array getConfigs()

Returns an array of paths to module config files.

Return Value

array

array getModules()

Returns an array of module names mapped to their paths.

"Modules" in SilverStripe are simply directories with a _config.php file.

Return Value

array

protected setDefaults()

Used to set up files that we want to exclude from parsing for performance reasons.

regenerate(bool $cache = true)

Completely regenerates the manifest file.

Parameters

bool $cache

Cache the result.

handleDir($basename, $pathname, $depth)

No description

Parameters

$basename
$pathname
$depth

protected string findClassOrInterfaceFromCandidateImports(string $class, string $namespace = '', array $imports = array())

Find a the full namespaced declaration of a class (or interface) from a list of candidate imports

This is typically used to determine the full class name in classes that have imported namesapced symbols (having used the use keyword)

NB: remember the '\' is an escaped backslash and is interpreted as a single \

Parameters

string $class

The class (or interface) name to find in the candidate imports

string $namespace

The namespace that was declared for the classes definition (if there was one)

array $imports

The list of imported symbols (Classes or Interfaces) to test against

Return Value

string

The fully namespaced class name

protected array getImportsFromTokens(array $tokens)

Return an array of array($alias => $import) from tokenizer's tokens of a PHP file

NB: If there is no alias we don't set a key to the array

Parameters

array $tokens

The parsed tokens from tokenizer's parsing of a PHP file

Return Value

array

The array of imports as (optional) $alias => $import

handleFile($basename, $pathname, $depth)

No description

Parameters

$basename
$pathname
$depth

protected array coalesceDescendants(string $class)

Recursively coalesces direct child information into full descendant information.

Parameters

string $class

Return Value

array

addDouble($double, $doubled, $isInterface = false)

No description

Parameters

$double
$doubled
$isInterface

static register_double(string $double, string $of, bool $isDoubleOfInterface = false)

The callback that Phockito will call every time there's a new double created

Parameters

string $double
  • The class name of the new double
string $of
  • The class new of the doubled class or interface
bool $isDoubleOfInterface
  • True if $of is an interface, False if it's a class