class Helpers

Utility methods for file I/O, path handling, annotation parsing, and shell escaping.

Methods

static string
readFile(string $file)

Reads entire file into a string.

static void
purge(string $dir)

Creates directory if it does not exist and deletes all its contents.

static string
findCommonDirectory(array $paths)

Finds the common ancestor directory of the given paths. All paths must exist.

static array
parseDocComment(string $s)

Parses the first docblock in a string into an array of annotation values.

static string
errorTypeToString(int $type)

No description

static string
escapeArg(string $s)

Escapes a string for safe use as a shell argument.

static string
prepareTempDir(string $path)

No description

Details

at line 23
static string readFile(string $file)

Reads entire file into a string.

Parameters

string $file

Return Value

string

Exceptions

Exception

at line 37
static void purge(string $dir)

Creates directory if it does not exist and deletes all its contents.

Parameters

string $dir

Return Value

void

at line 63
static string findCommonDirectory(array $paths)

internal  
 

Finds the common ancestor directory of the given paths. All paths must exist.

Parameters

array $paths

Return Value

string

empty string when not found; separators normalized to DIRECTORY_SEPARATOR

at line 95
static array parseDocComment(string $s)

internal  
 

Parses the first docblock in a string into an array of annotation values.

Parameters

string $s

Return Value

array

annotation name => value(s)

at line 125
static string errorTypeToString(int $type)

internal  
 

No description

Parameters

int $type

Return Value

string

at line 142
static string escapeArg(string $s)

internal  
 

Escapes a string for safe use as a shell argument.

Parameters

string $s

Return Value

string

at line 157
static string prepareTempDir(string $path)

internal  
 

No description

Parameters

string $path

Return Value

string