UciCommandProvider
extends UciProvider
in package
Represents all translation from UCI Command to Array Object in PHP.
Table of Contents
- ALL_INDEXES_SECTION = -5
- This constant load all options in each section.
- IS_OBJECT_SECTION = -10
- This constant is for represent that is an array.
- NOT_FOUND = 'not found'
- This is the text that shows the uci system when a resource is not found.
- UCI_SHOW = 'uci show'
- This is the command to extract all the information from the UCI System.
- dispatchAction() : array<string|int, mixed>
- Execute the action in the uci system.
- get() : string
- Return the output for the specified resource Validate the each field used as input Also if the resource is not found return an empty string.
- getConfigurationCommand() : array<string|int, mixed>
- Execute a command to extract all the information from the UCI System.
- getUciConfiguration() : array<string|int, mixed>
- Return an object with the representation for the UCI System.
- getUciSection() : void
- - If a section is an array is saved as a Array.
- cleanInput() : string
- Return a string to use in a command shell.
- getIndexSection() : int
- Return an index in the string contained between [] or -1 otherwise For example: For the input => '@system[14]' You obtain => 14.
- getNameSection() : string
- Return the name section that is contained between @ and [ or same string otherwise For example: For the input => '@system[14]' You obtain => 'system'.
Constants
ALL_INDEXES_SECTION
This constant load all options in each section.
public
mixed
ALL_INDEXES_SECTION
= -5
IS_OBJECT_SECTION
This constant is for represent that is an array.
public
mixed
IS_OBJECT_SECTION
= -10
NOT_FOUND
This is the text that shows the uci system when a resource is not found.
public
string
NOT_FOUND
= 'not found'
UCI_SHOW
This is the command to extract all the information from the UCI System.
public
string
UCI_SHOW
= 'uci show'
Methods
dispatchAction()
Execute the action in the uci system.
public
dispatchAction(mixed $action, mixed $config, mixed $section, mixed $indexSection, mixed $option, mixed $value) : array<string|int, mixed>
Parameters
- $action : mixed
- $config : mixed
- $section : mixed
- $indexSection : mixed
- $option : mixed
- $value : mixed
Tags
Return values
array<string|int, mixed> —get()
Return the output for the specified resource Validate the each field used as input Also if the resource is not found return an empty string.
public
static get(string $config, string $section, string $option) : string
Parameters
- $config : string
-
file to find in /etc/config for default
- $section : string
-
to find in the config
- $option : string
-
to find in the section for the config
Return values
string —getConfigurationCommand()
Execute a command to extract all the information from the UCI System.
public
static getConfigurationCommand() : array<string|int, mixed>
Return values
array<string|int, mixed> —getUciConfiguration()
Return an object with the representation for the UCI System.
public
static getUciConfiguration() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —getUciSection()
- If a section is an array is saved as a Array.
protected
static getUciSection(mixed &$configSection, mixed $sectionName, mixed $optionName, mixed $content) : void
Parameters
- $configSection : mixed
- $sectionName : mixed
- $optionName : mixed
- $content : mixed
Tags
Return values
void —cleanInput()
Return a string to use in a command shell.
private
static cleanInput(string $input) : string
Parameters
- $input : string
Return values
string —getIndexSection()
Return an index in the string contained between [] or -1 otherwise For example: For the input => '@system[14]' You obtain => 14.
private
static getIndexSection(string $section) : int
For the input => 'system20' You obtain => -1
Parameters
- $section : string
Return values
int —getNameSection()
Return the name section that is contained between @ and [ or same string otherwise For example: For the input => '@system[14]' You obtain => 'system'.
private
static getNameSection(string $section) : string
For the input => 'system20' You obtain => 'system20'
Parameters
- $section : string