class ValidateSimulatorCommand extends SimulatorCommandBase

Validates a simulator against the Simulator.xsd schema file.

Properties

protected string $name from CommandBase
protected string $version from CommandBase
protected array|false $parameters from CommandBase
protected string $projectDir from CommandBase
protected string $publicDir from CommandBase
protected Translator $translator from CommandBase
protected bool $initialized from CommandBase
protected bool $html from CommandBase
private array $tables

Methods

__construct(string $projectDir)

No description

void
doInitialization()

Realizes the initialization this command

array|false
getParameters()

This function parses the '.env' file and returns an array of parameters

string
getParameterValue(string $parameter)

Returns the value of a parameter

string
getConfigParameter(string $parameter)

Gets a parameter with its name.

void
configure()

Configures the current command.

void
initialize(InputInterface $input, OutputInterface $output)

initializes the current command.

void
askArgument(InputInterface $input, OutputInterface $output, string $argumentName, string $questionText)

Asks an argument if it's not supplied in the command line.

int|null
execute(InputInterface $input, OutputInterface $output)

No description

bool
runEmbeddedCommand(array $command, InputInterface $input, OutputInterface $output)

Run an embedded console command.

DOMElement|null
castDOMElement(DOMNode $node)

Casts a DOMNode to DOMElement

DOMElement|null
getDOMElementItem(DOMNodeList $nodes, int $index)

Retuns the DOMElement at position $index of the DOMNodeList

string
resolvePath(string $path, string $base)

Converts a relative path of a file to an absolute path

array
findFile(string $in, string $name, InputInterface $input, OutputInterface $output, array $filters = [])

Finds files in the subdirectories of a giving directory

string|int
findAssetsDirectory(string $in, InputInterface $input, OutputInterface $output)

Finds the assets directory

string|int
findTemplatesDirectory(string $in, InputInterface $input, OutputInterface $output)

Finds the templates directory

string|int
findPDFFormsDirectory(string $in, InputInterface $input, OutputInterface $output)

Finds the pdf forms directory

string|int
findSimulatorsDirectory(string $in, InputInterface $input, OutputInterface $output)

Finds the simulators directory

bool
isHtml()

Returns true, if the message are displayed in HTML, false if not.

void
message(OutputInterface $output, string $message, array $parameters = [], string $start = 'info', string $end = 'info', int $verbosity = OutputInterface::VERBOSITY_NORMAL)

Displays an message

void
info(OutputInterface $output, string $message, array $parameters = [])

Displays an info message

void
warning(OutputInterface $output, string $message, array $parameters = [])

Displays a warning message

void
success(OutputInterface $output, string $message, array $parameters = [])

Displays a success message

void
failure(OutputInterface $output, string $message, array $parameters = [])

Displays a failure message

void
fatal(OutputInterface $output, string $message, array $parameters = [])

Displays an fatal error message

void
error(OutputInterface $output, string $message, array $parameters = [])

Displays an error message

void
debug(OutputInterface $output, string $message, array $parameters = [])

Displays a debug message

void
comment(OutputInterface $output, string $message, array $parameters = [])

Displays a comment

string
getCommandName()

No description

string
getCommandDescription()

No description

string
getCommandHelp()

No description

array
getCommandArguments()

No description

array
getCommandOptions()

No description

bool
validatesAgainstSchema(DOMDocument $simulator, OutputInterface $output)

Validates the simulator against its schema

bool
fixDatasourcesReference(DOMDocument $simulator, string $path, InputInterface $input, OutputInterface $output)

Replaces the numeric data source reference by the name of the data source The name of the data source if extracted from the DataSources.xml

void
fixNewAttributes(DOMDocument $simulator)

Sets the missing new attributes of the schema: - regionale settings (locale, timezone and grouping separator) by those of this platform - pdfFooter flag

bool
setWidgets(DOMDocument $simulator, array $widgets)

Sets the default widgets

void
addToManifest($assetpath, $output)

Adds a stylesheet to the assets manifest

void
interact(InputInterface $input, OutputInterface $output)

Checks the argument of the current command (g6k:simulator:validate).

bool
validate(string $simulatorsDir, string $simulatorname, bool $schemaOnly, OutputInterface $output)

Validates the simulator

bool
checkDefaultViewElements(string $simu, DOMXPath $simulatorxpath, OutputInterface $output)

Checks the existence of the elements of the default view

bool
checkDataReferences(string $simu, DOMXPath $simulatorxpath, OutputInterface $output)

Checks the references of data

bool
checkDataUniqueness(string $simu, DOMXPath $simulatorxpath, OutputInterface $output)

Checks the uniqueness of id and data names

bool
checkSources(string $simu, DOMXPath $simulatorxpath, DOMXPath $datasourcesxpath, OutputInterface $output)

Checks the data sources

bool
checkBusinessRules(string $simu, DOMXPath $simulatorxpath, OutputInterface $output)

Checks the business rules

string
makeQuery(DOMElement $action)

Computes a xpath query to access the target element of a rule action

array
parseDatasourceTables(int $id, DOMXPath $datasourcesxpath, OutputInterface $output)

Extracts the tables of the given datasource id from the DataSources.xml file

bool
checkBusinessRulesUniqueness(string $simu, DOMXPath $simulatorxpath, OutputInterface $output)

Checks the uniqueness of id and business rule names

Details

at line 53
__construct(string $projectDir)

Parameters

string $projectDir The project directory

in CommandBase at line 111
private void doInitialization()

Realizes the initialization this command

Return Value

void

in CommandBase at line 136
private array|false getParameters()

This function parses the '.env' file and returns an array of parameters

Return Value

array|false parameters array or false in case of error

in CommandBase at line 169
private string getParameterValue(string $parameter)

Returns the value of a parameter

Parameters

string $parameter The given parameter

Return Value

string The value of the parameter

in CommandBase at line 184
protected string getConfigParameter(string $parameter)

Gets a parameter with its name.

Parameters

string $parameter The parameter name

Return Value

string The parameter value

in CommandBase at line 194
protected void configure()

Configures the current command.

Return Value

void

in CommandBase at line 228
protected void initialize(InputInterface $input, OutputInterface $output)

initializes the current command.

Parameters

InputInterface $input The input interface
OutputInterface $output The output interface

Return Value

void

Exceptions

LogicException

in CommandBase at line 259
protected void askArgument(InputInterface $input, OutputInterface $output, string $argumentName, string $questionText)

Asks an argument if it's not supplied in the command line.

Parameters

InputInterface $input The input interface
OutputInterface $output The output interface
string $argumentName The argument name
string $questionText The question text

Return Value

void

at line 134
protected int|null execute(InputInterface $input, OutputInterface $output)

Parameters

InputInterface $input The input interface
OutputInterface $output The output interface

Return Value

int|null null or 0 if everything went fine, or an error code

in CommandBase at line 307
protected bool runEmbeddedCommand(array $command, InputInterface $input, OutputInterface $output)

Run an embedded console command.

Parameters

array $command The command
InputInterface $input The input interface
OutputInterface $output The output interface

Return Value

bool

in CommandBase at line 325
protected DOMElement|null castDOMElement(DOMNode $node)

Casts a DOMNode to DOMElement

Parameters

DOMNode $node The DOMNodeList

Return Value

DOMElement|null The DOMElement.

in CommandBase at line 341
protected DOMElement|null getDOMElementItem(DOMNodeList $nodes, int $index)

Retuns the DOMElement at position $index of the DOMNodeList

Parameters

DOMNodeList $nodes The DOMNodeList
int $index The position in the DOMNodeList

Return Value

DOMElement|null The DOMElement.

in CommandBase at line 357
protected string resolvePath(string $path, string $base)

Converts a relative path of a file to an absolute path

Parameters

string $path The relative path name of the file
string $base The base path

Return Value

string

in CommandBase at line 385
protected array findFile(string $in, string $name, InputInterface $input, OutputInterface $output, array $filters = [])

Finds files in the subdirectories of a giving directory

Parameters

string $in The start directory of the search
string $name The base name of the searched file
InputInterface $input The input interface
OutputInterface $output The output interface
array $filters Optional, filters to apply to the search

Return Value

array The full path of the files or an empty array if none has been found

in CommandBase at line 438
protected string|int findAssetsDirectory(string $in, InputInterface $input, OutputInterface $output)

Finds the assets directory

Parameters

string $in The start directory of the search
InputInterface $input The input interface
OutputInterface $output The output interface

Return Value

string|int The full path of the directory or an error code (1: not found, 2: multiple found)

in CommandBase at line 482
protected string|int findTemplatesDirectory(string $in, InputInterface $input, OutputInterface $output)

Finds the templates directory

Parameters

string $in The start directory of the search
InputInterface $input The input interface
OutputInterface $output The output interface

Return Value

string|int The full path of the directory or an error code (1: not found, 2: multiple found)

in CommandBase at line 526
protected string|int findPDFFormsDirectory(string $in, InputInterface $input, OutputInterface $output)

Finds the pdf forms directory

Parameters

string $in The start directory of the search
InputInterface $input The input interface
OutputInterface $output The output interface

Return Value

string|int The full path of the directory or an error code (1: not found, 2: multiple found)

in CommandBase at line 570
protected string|int findSimulatorsDirectory(string $in, InputInterface $input, OutputInterface $output)

Finds the simulators directory

Parameters

string $in The start directory of the search
InputInterface $input The input interface
OutputInterface $output The output interface

Return Value

string|int The full path of the directory or an error code (1: not found, 2: multiple found)

in CommandBase at line 611
protected bool isHtml()

Returns true, if the message are displayed in HTML, false if not.

Return Value

bool

in CommandBase at line 627
private void message(OutputInterface $output, string $message, array $parameters = [], string $start = 'info', string $end = 'info', int $verbosity = OutputInterface::VERBOSITY_NORMAL)

Displays an message

Parameters

OutputInterface $output The output interface
string $message The message to display
array $parameters Optional, message parameters for translation
string $start The start tag
string $end The end tag
int $verbosity The verbosity option (default: OutputInterface::VERBOSITY_NORMAL), values : VERBOSITY_QUIET, VERBOSITY_NORMAL, VERBOSITY_VERBOSE, VERBOSITY_VERY_VERBOSE, VERBOSITY_DEBUG

Return Value

void

in CommandBase at line 647
protected void info(OutputInterface $output, string $message, array $parameters = [])

Displays an info message

Parameters

OutputInterface $output The output interface
string $message The message to display
array $parameters Optional, message parameters

Return Value

void

in CommandBase at line 664
protected void warning(OutputInterface $output, string $message, array $parameters = [])

Displays a warning message

Parameters

OutputInterface $output The output interface
string $message The message to display
array $parameters Optional, message parameters

Return Value

void

in CommandBase at line 681
protected void success(OutputInterface $output, string $message, array $parameters = [])

Displays a success message

Parameters

OutputInterface $output The output interface
string $message The message to display
array $parameters Optional, message parameters

Return Value

void

in CommandBase at line 698
protected void failure(OutputInterface $output, string $message, array $parameters = [])

Displays a failure message

Parameters

OutputInterface $output The output interface
string $message The message to display
array $parameters Optional, message parameters

Return Value

void

in CommandBase at line 715
protected void fatal(OutputInterface $output, string $message, array $parameters = [])

Displays an fatal error message

Parameters

OutputInterface $output The output interface
string $message The message to display
array $parameters Optional, message parameters

Return Value

void

in CommandBase at line 732
protected void error(OutputInterface $output, string $message, array $parameters = [])

Displays an error message

Parameters

OutputInterface $output The output interface
string $message The message to display
array $parameters Optional, message parameters

Return Value

void

in CommandBase at line 749
protected void debug(OutputInterface $output, string $message, array $parameters = [])

Displays a debug message

Parameters

OutputInterface $output The output interface
string $message The message to display
array $parameters Optional, message parameters

Return Value

void

in CommandBase at line 762
protected void comment(OutputInterface $output, string $message, array $parameters = [])

Displays a comment

Parameters

OutputInterface $output The output interface
string $message The message to display
array $parameters Optional, message parameters

Return Value

void

at line 60
protected string getCommandName()

Return Value

string The name

at line 67
protected string getCommandDescription()

Return Value

string The description

at line 74
protected string getCommandHelp()

Return Value

string The help text

at line 88
protected array getCommandArguments()

Return Value

array The help text

at line 101
protected array getCommandOptions()

Return Value

array The help text

in SimulatorCommandBase at line 97
protected bool validatesAgainstSchema(DOMDocument $simulator, OutputInterface $output)

Validates the simulator against its schema

Parameters

DOMDocument $simulator The simulator document
OutputInterface $output The output interface

Return Value

bool true if simulator is valid, false if not.

in SimulatorCommandBase at line 141
protected bool fixDatasourcesReference(DOMDocument $simulator, string $path, InputInterface $input, OutputInterface $output)

Replaces the numeric data source reference by the name of the data source The name of the data source if extracted from the DataSources.xml

Parameters

DOMDocument $simulator The simulator document
string $path The path where to find DataSources.xml
InputInterface $input The input interface
OutputInterface $output The output interface

Return Value

bool false if DataSources.xml is not found, true otherwise.

in SimulatorCommandBase at line 185
protected void fixNewAttributes(DOMDocument $simulator)

Sets the missing new attributes of the schema: - regionale settings (locale, timezone and grouping separator) by those of this platform - pdfFooter flag

Parameters

DOMDocument $simulator The simulator document

Return Value

void

in SimulatorCommandBase at line 231
protected bool setWidgets(DOMDocument $simulator, array $widgets)

Sets the default widgets

Parameters

DOMDocument $simulator The simulator document
array $widgets The widget list

Return Value

bool true if at least one of the widget has been set, false otherwise.

in SimulatorCommandBase at line 299
protected void addToManifest($assetpath, $output)

Adds a stylesheet to the assets manifest

Parameters

$assetpath
$output

Return Value

void

at line 126
protected void interact(InputInterface $input, OutputInterface $output)

Checks the argument of the current command (g6k:simulator:validate).

Parameters

InputInterface $input The input interface
OutputInterface $output The output interface

Return Value

void

at line 170
private bool validate(string $simulatorsDir, string $simulatorname, bool $schemaOnly, OutputInterface $output)

Validates the simulator

Parameters

string $simulatorsDir The directory where is located the simulator
string $simulatorname The simulator name
bool $schemaOnly true if the validation is against the schema only
OutputInterface $output The output interface

Return Value

bool true if simulator is valid, false if not.

at line 231
private bool checkDefaultViewElements(string $simu, DOMXPath $simulatorxpath, OutputInterface $output)

Checks the existence of the elements of the default view

Parameters

string $simu The simulator name
DOMXPath $simulatorxpath The simulator xpath
OutputInterface $output The output interface

Return Value

bool true if the elements exist, false if not.

at line 267
private bool checkDataReferences(string $simu, DOMXPath $simulatorxpath, OutputInterface $output)

Checks the references of data

Parameters

string $simu The simulator name
DOMXPath $simulatorxpath The simulator xpath
OutputInterface $output The output interface

Return Value

bool true if the references are valids, false if not.

at line 317
private bool checkDataUniqueness(string $simu, DOMXPath $simulatorxpath, OutputInterface $output)

Checks the uniqueness of id and data names

Parameters

string $simu The simulator name
DOMXPath $simulatorxpath The simulator xpath
OutputInterface $output The output interface

Return Value

bool true if id and data names are unique, false if not.

at line 356
private bool checkSources(string $simu, DOMXPath $simulatorxpath, DOMXPath $datasourcesxpath, OutputInterface $output)

Checks the data sources

Parameters

string $simu The simulator name
DOMXPath $simulatorxpath The simulator xpath
DOMXPath $datasourcesxpath The datasources xpath
OutputInterface $output The output interface

Return Value

bool true if the sources are valids, false if not.

at line 438
private bool checkBusinessRules(string $simu, DOMXPath $simulatorxpath, OutputInterface $output)

Checks the business rules

Parameters

string $simu The simulator name
DOMXPath $simulatorxpath The simulator xpath
OutputInterface $output The output interface

Return Value

bool true if the rules are valids, false if not.

at line 502
private string makeQuery(DOMElement $action)

Computes a xpath query to access the target element of a rule action

Parameters

DOMElement $action The rule action

Return Value

string The computed xpath query.

at line 528
private array parseDatasourceTables(int $id, DOMXPath $datasourcesxpath, OutputInterface $output)

Extracts the tables of the given datasource id from the DataSources.xml file

Parameters

int $id The datasource id
DOMXPath $datasourcesxpath The datasources xpath
OutputInterface $output The output interface

Return Value

array The parsed tables.

at line 589
private bool checkBusinessRulesUniqueness(string $simu, DOMXPath $simulatorxpath, OutputInterface $output)

Checks the uniqueness of id and business rule names

Parameters

string $simu The simulator name
DOMXPath $simulatorxpath The simulator xpath
OutputInterface $output The output interface

Return Value

bool true if id and data names are unique, false if not.