Modules
extends Script
in package
Uses
HandleExceptionTrait
Class Modules
Script to Install a plugin or processor module in ApiOpenStudio
Table of Contents
- $argMap : array<string|int, mixed>
- The command argument map array.
- $arguments : array<string|int, mixed>
- The command arguments array.
- $exec : string
- The current executed argument.
- $flags : array<string|int, mixed>
- The command flags array.
- $moduleHelper : ModuleHelper
- $options : array<string|int, mixed>
- The command options array.
- __construct() : mixed
- Install constructor.
- exec() : void
- Execute the function.
- load() : void
- Load arguments for the function.
- handleException() : void
- Handle exceptions for CLI in a generic way.
- help() : void
- Abstract function help.
- installed() : void
- Display a list of installed modules and versions.
- list() : void
- Display a list of non-core plugins and processors installed by composer.
- readlineTerminal() : false|string
- Fetch a parameter from the command line.
- timeToDie() : void
- Helper function to die.
- uninstalled() : void
- Display a list of modules that are not installed.
- updates() : void
- Display a list of pending updates for all or a single module.
- getArgs() : void
- Parse and store arguments.
- getValues() : void
- Either store value as single value or array of values
- install() : void
- Install one or more modules.
- uninstall() : void
- Uninstall one or more modules.
- update() : void
- Update one or more modules.
- validateAllowed() : void
- Validate all supplied arguments are allowed.
- validateFlags() : void
- Validate supplied flags.
- validateMultiple() : void
- Validate any supplied arguments with multiple values are allowed.
- validateOptions() : void
- Validate supplied options.
- validatePermitted() : void
- Validate against any permitted value restrictions.
- validateRequired() : void
- Validate all required options are present.
Properties
$argMap
The command argument map array.
protected
array<string|int, mixed>
$argMap
= ['options' => [], 'flags' => ['installed' => [], 'uninstalled' => [], 'updates' => [], 'list' => [], 'install' => [], 'uninstall' => [], 'update' => []]]
Command argument map.
$arguments
The command arguments array.
protected
array<string|int, mixed>
$arguments
Command args.
$exec
The current executed argument.
protected
string
$exec
Current executed arg.
$flags
The command flags array.
protected
array<string|int, mixed>
$flags
Command flags.
$moduleHelper
protected
ModuleHelper
$moduleHelper
$options
The command options array.
protected
array<string|int, mixed>
$options
Command options.
Methods
__construct()
Install constructor.
public
__construct() : mixed
Return values
mixed —exec()
Execute the function.
public
exec([array<string|int, mixed>|null $argv = null ]) : void
Parameters
- $argv : array<string|int, mixed>|null = null
-
CLI args.
Return values
void —load()
Load arguments for the function.
public
load(array<string|int, mixed> $argv) : void
Parameters
- $argv : array<string|int, mixed>
-
CLI args.
Return values
void —handleException()
Handle exceptions for CLI in a generic way.
protected
handleException(ApiException $e) : void
Parameters
- $e : ApiException
Return values
void —help()
Abstract function help.
protected
help() : void
Return values
void —installed()
Display a list of installed modules and versions.
protected
installed() : void
Return values
void —list()
Display a list of non-core plugins and processors installed by composer.
protected
list() : void
Return values
void —readlineTerminal()
Fetch a parameter from the command line.
protected
readlineTerminal([string $prompt = '' ]) : false|string
Parameters
- $prompt : string = ''
-
Input prompt text.
Return values
false|string —Response in from the user.
timeToDie()
Helper function to die.
protected
timeToDie(string|array<string|int, mixed> $msg) : void
Parameters
- $msg : string|array<string|int, mixed>
-
Log message.
Return values
void —uninstalled()
Display a list of modules that are not installed.
protected
uninstalled() : void
Return values
void —updates()
Display a list of pending updates for all or a single module.
protected
updates() : void
Return values
void —getArgs()
Parse and store arguments.
private
getArgs(array<string|int, mixed> $args) : void
Parameters
- $args : array<string|int, mixed>
-
Cli arguments.
Return values
void —getValues()
Either store value as single value or array of values
private
getValues(mixed $index, mixed $value) : void
Parameters
- $index : mixed
-
Option index.
- $value : mixed
-
Option value.
Return values
void —install()
Install one or more modules.
private
install(array<string|int, mixed> $modules) : void
Parameters
- $modules : array<string|int, mixed>
Return values
void —uninstall()
Uninstall one or more modules.
private
uninstall(array<string|int, mixed> $modules) : void
Parameters
- $modules : array<string|int, mixed>
Return values
void —update()
Update one or more modules.
private
update(array<string|int, mixed> $modules) : void
Parameters
- $modules : array<string|int, mixed>
Return values
void —validateAllowed()
Validate all supplied arguments are allowed.
private
validateAllowed(string $name, mixed $index) : void
Parameters
- $name : string
-
Arg name.
- $index : mixed
-
Arg index.
Return values
void —validateFlags()
Validate supplied flags.
private
validateFlags() : void
Return values
void —validateMultiple()
Validate any supplied arguments with multiple values are allowed.
private
validateMultiple(string $name, mixed $value, mixed $index) : void
Parameters
- $name : string
-
Arg name.
- $value : mixed
-
Arg value.
- $index : mixed
-
Arg index.
Return values
void —validateOptions()
Validate supplied options.
private
validateOptions() : void
Return values
void —validatePermitted()
Validate against any permitted value restrictions.
private
validatePermitted(string $name, mixed $value, mixed $index) : void
Parameters
- $name : string
-
Arg name.
- $value : mixed
-
Arg value.
- $index : mixed
-
Arg index.
Return values
void —validateRequired()
Validate all required options are present.
private
validateRequired(array<string|int, mixed> $opt, mixed $index) : void
Parameters
- $opt : array<string|int, mixed>
-
Option name.
- $index : mixed
-
Option index.