Scripts2020
extends CoreLogic2020
in package
Class to be extended for the creation of a scripts
The sintax is: Class Logic extends CoreLogic2020() {..}
Normally your file has to be stored in the logic/
directory and extend this class.
Table of Contents
Properties
- $argv : array<string|int, mixed>
- $cache : CoreCache
- $cache_data : mixed
- $cache_secret_iv : mixed
- $cache_secret_key : mixed
- $error : bool
- $errorMsg : array<string|int, mixed>
- $formParams : array<string|int, mixed>
- $method : string
- $params : array<string|int, mixed>
- $sendTerminal : mixed
- $tests : mixed
- $time : mixed
- $vars : mixed
- $core : Core7
Methods
- __construct() : mixed
- Scripts constructor.
- addError() : mixed
- Add an error in the class
- cleanCache() : mixed
- getCacheVar() : mixed
- getERPTokenWithGoogleAccessToken() : mixed|void
- Return the ERP for the user using a Google Access token for specific namespace
- getFormParams() : mixed
- getOptionVar() : mixed
- getParams() : mixed
- getUserGoogleAccessToken() : array<string|int, mixed>|mixed|void
- hasOption() : mixed
- prompt() : false|string|null
- Execute a user Prompt
- promptVar() : false|string|null
- Execute a user Prompt user for a specific var $options['title'] = titlte to be shown $options['default'] = default value $options['values'] = [array of valid values] $options['cache_var'] = 'name to cache the result. If result is cached it rewrites default' $options['type'] = password | number | float $options['allowed_values'] = allowed values
- readCache() : mixed
- render() : mixed
- Try to render a template
- sendTerminal() : mixed
- setCacheVar() : mixed
- setErrorFromCodelib() : mixed
- Add an error in the script. This method exist to be compatible with RESTFull class
- useFunction() : bool
- Execute a method if $method is defined.
Properties
$argv
public
array<string|int, mixed>
$argv
= \null
Keep the arguments passed to the logic if it runs as a script
$cache
public
CoreCache
$cache
= \null
$cache_data
public
mixed
$cache_data
= \null
$cache_secret_iv
public
mixed
$cache_secret_iv
= ''
$cache_secret_key
public
mixed
$cache_secret_key
= ''
$error
public
bool
$error
= \false
Indicates if an error has been produced
$errorMsg
public
array<string|int, mixed>
$errorMsg
= []
Keep the error messages
$formParams
public
array<string|int, mixed>
$formParams
= array()
Contains the variables passed in a GET,POST,PUT call intro an URL
$method
public
string
$method
= 'GET'
indicates the HTTP method used to access the script: GET, POST etc.. Default value is GET
$params
public
array<string|int, mixed>
$params
= array()
contains the substrings paths of an URL script/param0/param1/..
$sendTerminal
public
mixed
$sendTerminal
= []
$tests
public
mixed
$tests
$time
public
mixed
$time
= \null
$vars
public
mixed
$vars
= []
$core
protected
Core7
$core
pointer to the Core class. $this->core->...
Methods
__construct()
Scripts constructor.
public
__construct(Core7 $core[, null $argv = null ]) : mixed
Parameters
- $core : Core7
- $argv : null = null
addError()
Add an error in the class
public
addError( $value) : mixed
Parameters
cleanCache()
public
cleanCache() : mixed
getCacheVar()
public
getCacheVar(mixed $var) : mixed
Parameters
- $var : mixed
getERPTokenWithGoogleAccessToken()
Return the ERP for the user using a Google Access token for specific namespace
public
getERPTokenWithGoogleAccessToken([string $namespace = '' ][, string $user = '' ]) : mixed|void
Parameters
- $namespace : string = ''
- $user : string = ''
Return values
mixed|voidgetFormParams()
public
getFormParams(mixed $var) : mixed
Parameters
- $var : mixed
getOptionVar()
public
getOptionVar(mixed $option) : mixed
Parameters
- $option : mixed
getParams()
public
getParams(mixed $index) : mixed
Parameters
- $index : mixed
getUserGoogleAccessToken()
public
getUserGoogleAccessToken([string $user = '' ]) : array<string|int, mixed>|mixed|void
Parameters
- $user : string = ''
-
optional is the Google user email. If empty it will prompt it
Return values
array<string|int, mixed>|mixed|voidhasOption()
public
hasOption(mixed $option) : mixed
Parameters
- $option : mixed
prompt()
Execute a user Prompt
public
prompt( $title[, null $default = null ][, null $cache_var = null ]) : false|string|null
Parameters
Return values
false|string|nullpromptVar()
Execute a user Prompt user for a specific var $options['title'] = titlte to be shown $options['default'] = default value $options['values'] = [array of valid values] $options['cache_var'] = 'name to cache the result. If result is cached it rewrites default' $options['type'] = password | number | float $options['allowed_values'] = allowed values
public
promptVar( $options) : false|string|null
Parameters
Return values
false|string|nullreadCache()
public
readCache() : mixed
render()
Try to render a template
public
render(string $template) : mixed
Parameters
- $template : string
-
Path to the template
sendTerminal()
public
sendTerminal([mixed $info = '' ]) : mixed
Parameters
- $info : mixed = ''
setCacheVar()
public
setCacheVar(mixed $var, mixed $value) : mixed
Parameters
- $var : mixed
- $value : mixed
setErrorFromCodelib()
Add an error in the script. This method exist to be compatible with RESTFull class
public
setErrorFromCodelib( $code, $msg) : mixed
Parameters
useFunction()
Execute a method if $method is defined.
public
useFunction(string $method) : bool
Parameters
- $method : string
-
name of the method