class ContextGenerator (View source)

Used for context generation.

Constants

TEMPLATE

The template of a context.

Parameters: 1 - name 2 - class 3 - link 4 - keywords array

Properties

static array<string,int> $LABELS_FLAGS

Labels and flags that may be used when defining keywords.

$LINKS

Documentation links for each context.

Methods

static array<int,array<int,array<int,string>>>
sortWords(array $arr)

Sorts an array of words.

static array<int,array<int,array<int,string>>>
readWords(array $files)

Reads a list of words and sorts it by type, length and keyword.

static string
printWords(array<int,array<int,array<int,string>>> $words, int $spaces = 8, int $line = 140)

Prints an array of a words in PHP format.

static string
generate(array<string,string|array<int,array<int,array<int,string>>>> $options)

Generates a context's class.

static string
formatName(string $name)

Formats context name.

static void
build(string $input, string $output)

Builds a test.

static void
buildAll(string $input, string $output)

Generates recursively all tests preserving the directory structure.

Details

static array<int,array<int,array<int,string>>> sortWords(array $arr)

Sorts an array of words.

Parameters

array $arr

Return Value

array<int,array<int,array<int,string>>>

static array<int,array<int,array<int,string>>> readWords(array $files)

Reads a list of words and sorts it by type, length and keyword.

Parameters

array $files

Return Value

array<int,array<int,array<int,string>>>

static string printWords(array<int,array<int,array<int,string>>> $words, int $spaces = 8, int $line = 140)

Prints an array of a words in PHP format.

Parameters

array<int,array<int,array<int,string>>> $words

the list of words to be formatted

int $spaces

the number of spaces that starts every line

int $line

the length of a line

Return Value

string

static string generate(array<string,string|array<int,array<int,array<int,string>>>> $options)

Generates a context's class.

Parameters

array<string,string|array<int,array<int,array<int,string>>>> $options

the options for this context

Return Value

string

static string formatName(string $name)

Formats context name.

Parameters

string $name

name to format

Return Value

string

static void build(string $input, string $output)

Builds a test.

Reads the input file, generates the data and writes it back.

Parameters

string $input

the input file

string $output

the output directory

Return Value

void

static void buildAll(string $input, string $output)

Generates recursively all tests preserving the directory structure.

Parameters

string $input

the input directory

string $output

the output directory

Return Value

void