class Tools

Contains functions for miscellaneous tasks.

Methods

static string
border()

Returns dashed border.

static int
createDirWithPrompt(string $directory, InputInterface $cmdInput, OutputInterface $cmdOutput)

Creates a directory. It checks if it already exists. If not, user is asked to confirm the want to create a new directory.

static array|int
dotNotationVerify(string $inputName, InputInterface $input)

Checks if input is in dot notation. If in dot notation the string is placed in an array where the first index is the directory name. The second element is the file name. The structure is shown below:

static void
pathExists(string $path, int $permissions = 0755, bool $recursive = true)

Tests if a path exits and creates it if necessary.

static int
writeFile(string $path, string $content, string $name)

Generates files for console commands

Details

at line 20
static string border()

Returns dashed border.

Return Value

string

A dashed border.

at line 32
static int createDirWithPrompt(string $directory, InputInterface $cmdInput, OutputInterface $cmdOutput)

Creates a directory. It checks if it already exists. If not, user is asked to confirm the want to create a new directory.

Parameters

string $directory

The full path for the directory to be created.

InputInterface $cmdInput
OutputInterface $cmdOutput

Return Value

int

A value that indicates success, invalid, or failure.

at line 81
static array|int dotNotationVerify(string $inputName, InputInterface $input)

Checks if input is in dot notation. If in dot notation the string is placed in an array where the first index is the directory name. The second element is the file name. The structure is shown below:

["directory_name","file_name"]

If not in the . an error message is displayed an a Command::FAILURE integer value is returned.

Parameters

string $inputName

The name in . format.

InputInterface $input

The Symfony InputInterface object.

Return Value

array|int

An array containing the contents of the $inputName variable. If $inputName is not in correct format then Command::FAILURE is returned.

at line 102
static void pathExists(string $path, int $permissions = 0755, bool $recursive = true)

Tests if a path exits and creates it if necessary.

Parameters

string $path

The path to check if it exists.

int $permissions

The permissions for the directory.

bool $recursive

Optional. Specifies if the recursive mode is set.

Return Value

void

at line 116
static int writeFile(string $path, string $content, string $name)

Generates files for console commands

Parameters

string $path

Where the file will be written.

string $content

The contents of the file to be created.

string $name

The name of the file, class, or other relevant information.

Return Value

int

A value that indicates success, invalid, or failure.