PluginService
extends Service
in package
Uses
ServiceTrait, CacheTrait
This is the plugin service class.
This class will retrieve the plugins from LogiCommerce API and transform them to objects. All the needed plugins operations previous to Framework must be done here.
Tags
Table of Contents
DELETE | = \SDK\Core\Enums\MethodType::DELETE | |
---|---|---|
GET | = \SDK\Core\Enums\MethodType::GET | |
ITEMS | = 'items' | |
POST | = \SDK\Core\Enums\MethodType::POST | |
PUT | = \SDK\Core\Enums\MethodType::PUT | |
addGetAssets() | Add the request to get the website available asset | : void |
addGetPluginProperties() | Add the request to get the plugin properties by the given id | : void |
addGetPluginPropertiesByModule() | Add the request to get the plugin properties by the given module | : void |
addGetPlugins() | Add the request to get the Commerce plugin collection | : void |
addGetUserPluginPaymentTokens() | Add the request to get the plugin payment system tokens for the current user | : void |
addGetUserPluginProperties() | Add the request to get the plugin properties for the current user | : void |
deleteUserPluginPaymentTokens() | Delete the plugin payment tokens for the current user with the given id and token | : Status|null |
deleteUserPluginProperties() | Delete the plugin properties for the current user with the given id | : Status|null |
executePluginData() | Execute the given action over the given plugin | : PluginData|null |
getActionParametersGroup() | Execute the given action over the given plugin | : PluginData|null |
getAssets() | Returns the website available asset | : ElementCollection|null |
getInstance() | Returns the requested model instance. | : Service |
getModuleTriggers() | Return all triggers for a plugin module | : array<string|int, mixed> |
getPluginProperties() | Returns the plugin properties by the given id | : PluginProperties|null |
getPluginPropertiesByModule() | Returns the plugin properties by the given module name | : ElementCollection|null |
getPlugins() | Returns the Commerce plugin collection. | : ElementCollection|null |
getUserPluginPaymentTokens() | Returns the plugin payment tokens for the current user | : ElementCollection|null |
getUserPluginProperties() | Returns the plugin properties for the current user | : ElementCollection|null |
__construct() | : mixed | |
call() | : array<string|int, mixed> | |
extractParameters() | : array<string|int, mixed> | |
getCollection() | : mixed | |
getConnection() | : Connection | |
getElement() | : Element|null | |
getElements() | : ElementCollection|null | |
getResourceElement() | : Element|null | |
getResponse() | : ElementCollection|null | |
prepareElement() | : Element|null | |
prepareElements() | : array<string|int, mixed> | |
replaceWildcards() | : string |
Constants
DELETE
protected
mixed
DELETE
= \SDK\Core\Enums\MethodType::DELETE
GET
protected
mixed
GET
= \SDK\Core\Enums\MethodType::GET
ITEMS
protected
mixed
ITEMS
= 'items'
POST
protected
mixed
POST
= \SDK\Core\Enums\MethodType::POST
PUT
protected
mixed
PUT
= \SDK\Core\Enums\MethodType::PUT
Methods
addGetAssets()
Add the request to get the website available asset
public
addGetAssets(BatchRequests $batchRequests, string $batchName[, AssetParametersGroup $params = null ]) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
- $params : AssetParametersGroup = null
-
object with the needed filters to send to the API asset resource
Return values
void —addGetPluginProperties()
Add the request to get the plugin properties by the given id
public
addGetPluginProperties(BatchRequests $batchRequests, string $batchName, int $id) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
- $id : int
Return values
void —addGetPluginPropertiesByModule()
Add the request to get the plugin properties by the given module
public
addGetPluginPropertiesByModule(BatchRequests $batchRequests, string $batchName, int $module) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
- $module : int
Return values
void —addGetPlugins()
Add the request to get the Commerce plugin collection
public
addGetPlugins(BatchRequests $batchRequests, string $batchName, string $type) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
- $type : string
Return values
void —addGetUserPluginPaymentTokens()
Add the request to get the plugin payment system tokens for the current user
public
addGetUserPluginPaymentTokens(BatchRequests $batchRequests, string $batchName, int $id) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
- $id : int
Return values
void —addGetUserPluginProperties()
Add the request to get the plugin properties for the current user
public
addGetUserPluginProperties(BatchRequests $batchRequests, string $batchName, string $type) : void
Parameters
- $batchRequests : BatchRequests
- $batchName : string
-
the name that will identify the request on the batch return.
- $type : string
Return values
void —deleteUserPluginPaymentTokens()
Delete the plugin payment tokens for the current user with the given id and token
public
deleteUserPluginPaymentTokens(int $id, string $token) : Status|null
Parameters
- $id : int
- $token : string
Return values
Status|null —deleteUserPluginProperties()
Delete the plugin properties for the current user with the given id
public
deleteUserPluginProperties(int $id) : Status|null
Parameters
- $id : int
Return values
Status|null —executePluginData()
Execute the given action over the given plugin
public
executePluginData(int $id, string $module, PluginDataParametersGroup $params) : PluginData|null
Parameters
- $id : int
- $module : string
- $params : PluginDataParametersGroup
-
object with the needed filters to send to the API pluginData resource
Return values
PluginData|null —getActionParametersGroup()
Execute the given action over the given plugin
public
getActionParametersGroup(string $triggerName, string $module, string $action[, $data = null ]) : PluginData|null
Parameters
- $triggerName : string
- $module : string
- $action : string
- $data : = null
-
object with the needed filters to send to the API pluginData resource
Return values
PluginData|null —getAssets()
Returns the website available asset
public
getAssets([AssetParametersGroup $params = null ]) : ElementCollection|null
Parameters
- $params : AssetParametersGroup = null
-
object with the needed filters to send to the API asset resource
Return values
ElementCollection|null —getInstance()
Returns the requested model instance.
public
static getInstance() : Service
If is not setted, this method will set it.
Return values
Service —getModuleTriggers()
Return all triggers for a plugin module
public
getModuleTriggers(string $module) : array<string|int, mixed>
Parameters
- $module : string
-
the name of the module for the request of triggers.
Return values
array<string|int, mixed> —getPluginProperties()
Returns the plugin properties by the given id
public
getPluginProperties(int $id) : PluginProperties|null
Parameters
- $id : int
Return values
PluginProperties|null —getPluginPropertiesByModule()
Returns the plugin properties by the given module name
public
getPluginPropertiesByModule(string $module) : ElementCollection|null
Parameters
- $module : string
Return values
ElementCollection|null —getPlugins()
Returns the Commerce plugin collection.
public
getPlugins([string $type = PluginConnectorType::NONE ]) : ElementCollection|null
Parameters
- $type : string = PluginConnectorType::NONE
Return values
ElementCollection|null —getUserPluginPaymentTokens()
Returns the plugin payment tokens for the current user
public
getUserPluginPaymentTokens(int $id) : ElementCollection|null
Parameters
- $id : int
Return values
ElementCollection|null —getUserPluginProperties()
Returns the plugin properties for the current user
public
getUserPluginProperties(string $type) : ElementCollection|null
Parameters
- $type : string
Return values
ElementCollection|null —__construct()
protected
__construct() : mixed
Return values
mixed —call()
protected
call(Request $request[, string $apiUrl = null ]) : array<string|int, mixed>
Parameters
- $request : Request
- $apiUrl : string = null
Return values
array<string|int, mixed> —extractParameters()
protected
extractParameters([ParametersGroup|null $parametersGroup = null ]) : array<string|int, mixed>
Parameters
- $parametersGroup : ParametersGroup|null = null
Return values
array<string|int, mixed> —getCollection()
protected
getCollection(array<string|int, mixed> $data, string $class) : mixed
Parameters
- $data : array<string|int, mixed>
- $class : string
Return values
mixed —getConnection()
protected
getConnection() : Connection
Return values
Connection —getElement()
protected
getElement(string $class, string $resource[, int $id = null ][, mixed $params = null ]) : Element|null
Parameters
- $class : string
- $resource : string
- $id : int = null
- $params : mixed = null
Return values
Element|null —getElements()
protected
getElements(string $class, string $resource[, ParametersGroup $parameters = null ]) : ElementCollection|null
Parameters
- $class : string
- $resource : string
- $parameters : ParametersGroup = null
Return values
ElementCollection|null —getResourceElement()
protected
getResourceElement(string $class, string $resource[, mixed $params = [] ]) : Element|null
Parameters
- $class : string
- $resource : string
- $params : mixed = []
Return values
Element|null —getResponse()
protected
getResponse(array<string|int, mixed> $data, string $class) : ElementCollection|null
Parameters
- $data : array<string|int, mixed>
- $class : string
Return values
ElementCollection|null —prepareElement()
protected
prepareElement(array<string|int, mixed> $data, string $class) : Element|null
Parameters
- $data : array<string|int, mixed>
- $class : string
Return values
Element|null —prepareElements()
protected
prepareElements(array<string|int, mixed> $data, string $class) : array<string|int, mixed>
Parameters
- $data : array<string|int, mixed>
- $class : string
Return values
array<string|int, mixed> —replaceWildcards()
protected
replaceWildcards(string $resource, array<string|int, mixed> $wildcards) : string
Parameters
- $resource : string
- $wildcards : array<string|int, mixed>