Toolkit

DrupalSanitiseCommands extends AbstractCommands
in package

Provides commands to check sanitisation fields.

Table of Contents

Properties

$io  : ConsoleIO
The Symfony Input Output.

Methods

areCommentFieldsSanitised()  : bool
Checks if the Comment fields are being sanitised.
areUserFieldsSanitised()  : bool
Checks if the User fields are being sanitised.
drupalCheckSanitisationClasses()  : mixed
Command to check existence of Sanitisation classes.
drupalCheckSanitisationFields()  : int
Command to check fields for sanitisation.
getConfigurationFile()  : mixed
Path to YAML configuration file containing command defaults.
getJson()  : array<string|int, mixed>
Returns the JSON parsed content.
getWorkingDir()  : string
Returns the current working directory.
isWebsiteInstalled()  : bool
Check if the website is installed.
optionPattern()  : string
Prepare regex to check if option exists with value "no".
getBin()  : string
Validate and return the path to given bin.
getBinPath()  : string
Return the path to given bin.
getConfigValue()  : mixed
{@inheritdoc}
getNodeBin()  : string
Validate and return the path to given bin from node packages.
getNodeBinPath()  : string
Return the path to given bin from node packages.
isSimulating()  : bool
Check if current command is being executed with option simulate.
taskExecute()  : mixed
Execute a command.
taskProcess()  : mixed
Process the file.
taskReplaceBlock()  : mixed
Replace block in a file.
createClassMap()  : array<string|int, mixed>
Generates a class map for given directory.
getDrushSanitizeInterface()  : string
Returns the Drush Sanitize Interface namespace depending on the current version.
registerCustomClasses()  : mixed
Register all classes in custom code directory folder that are not registered.
testMap()  : array<string|int, mixed>
Returns a static field map for test purposes.

Properties

Methods

areCommentFieldsSanitised()

Checks if the Comment fields are being sanitised.

public static areCommentFieldsSanitised() : bool

Validates the presence of the SanitizeCommentsCommands command.

Return values
bool

areUserFieldsSanitised()

Checks if the User fields are being sanitised.

public static areUserFieldsSanitised() : bool

Validates the presence of the SanitizeUserTableCommands command and ensure that the fields are not being ignored in the opts.yml file with the options --sanitize-password and --sanitize-email.

Return values
bool

drupalCheckSanitisationClasses()

Command to check existence of Sanitisation classes.

public drupalCheckSanitisationClasses(ConsoleIO $io) : mixed
Parameters
$io : ConsoleIO
Tags
command

drupal:check-sanitisation-classes

drupalCheckSanitisationFields()

Command to check fields for sanitisation.

public drupalCheckSanitisationFields(ConsoleIO $io[, array<string|int, mixed> $options = ['types' => InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'keywords' => InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'types-ignore' => InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY] ]) : int
Parameters
$io : ConsoleIO
$options : array<string|int, mixed> = ['types' => InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'keywords' => InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'types-ignore' => InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY]

Command options.

Tags
command

drupal:check-sanitisation-fields

option

types The field types to check.

option

keywords The keywords to look into field names.

SuppressWarnings

(PHPMD.CyclomaticComplexity)

SuppressWarnings

(PHPMD.NPathComplexity)

Return values
int

getConfigurationFile()

Path to YAML configuration file containing command defaults.

public getConfigurationFile() : mixed

Command classes should implement this method.

getJson()

Returns the JSON parsed content.

public getJson(string $filename[, mixed $throwException = true ]) : array<string|int, mixed>
Parameters
$filename : string
$throwException : mixed = true
Return values
array<string|int, mixed>

getWorkingDir()

Returns the current working directory.

public getWorkingDir() : string
Return values
string

The current working directory.

isWebsiteInstalled()

Check if the website is installed.

public isWebsiteInstalled() : bool
Return values
bool

optionPattern()

Prepare regex to check if option exists with value "no".

public static optionPattern(string $option) : string
Parameters
$option : string

The option name to check, i.e: sanitize-email.

Return values
string

getBin()

Validate and return the path to given bin.

protected getBin(string $name) : string
Parameters
$name : string

The bin to look for.

Tags
throws
TaskException
Return values
string

The bin path.

getBinPath()

Return the path to given bin.

protected getBinPath(string $name) : string
Parameters
$name : string
Return values
string

The path to given binary.

getConfigValue()

{@inheritdoc}

protected getConfigValue(mixed $key[, mixed $default = null ]) : mixed
Parameters
$key : mixed
$default : mixed = null

getNodeBin()

Validate and return the path to given bin from node packages.

protected getNodeBin(string $name) : string
Parameters
$name : string

The bin to look for.

Tags
throws
TaskException
Return values
string

The bin path.

getNodeBinPath()

Return the path to given bin from node packages.

protected getNodeBinPath(string $name) : string
Parameters
$name : string
Return values
string

The path to given binary.

isSimulating()

Check if current command is being executed with option simulate.

protected isSimulating() : bool
Return values
bool

True if using --simulate, false otherwise.

taskExecute()

Execute a command.

protected taskExecute(array<string|int, mixed> $tasks) : mixed
Parameters
$tasks : array<string|int, mixed>

An array with tasks to execute.

taskProcess()

Process the file.

protected taskProcess(string $source[, string $destination = '' ]) : mixed
Parameters
$source : string

The source file to process.

$destination : string = ''

The destination file.

taskReplaceBlock()

Replace block in a file.

protected taskReplaceBlock([string $filename = '' ]) : mixed
Parameters
$filename : string = ''

The file to process.

createClassMap()

Generates a class map for given directory.

private createClassMap(string $directory) : array<string|int, mixed>

Only consider classes inside the src folder.

Parameters
$directory : string

The directory to scan, usually 'lib'.

Return values
array<string|int, mixed>

getDrushSanitizeInterface()

Returns the Drush Sanitize Interface namespace depending on the current version.

private getDrushSanitizeInterface() : string
Return values
string

registerCustomClasses()

Register all classes in custom code directory folder that are not registered.

private registerCustomClasses(string $directory) : mixed

This assumes the Drupal namespace \Drupal[module].

Parameters
$directory : string

The directory to search for classes.

testMap()

Returns a static field map for test purposes.

private testMap() : array<string|int, mixed>
Return values
array<string|int, mixed>

        
On this page

Search results