\AbstractPicoPlugin

Abstract class to extend from when implementing a Pico plugin

Summary

Methods
Properties
Constants
__construct()
handleEvent()
setEnabled()
isEnabled()
isStatusChanged()
getPico()
__call()
getDependencies()
getDependants()
No public properties found
No constants found
checkDependencies()
checkDependants()
$enabled
$statusChanged
$dependsOn
N/A
No private methods found
$pico
$dependants
N/A

Properties

$enabled

$enabled : boolean

Boolean indicating if this plugin is enabled (true) or disabled (false)

Type

boolean

$statusChanged

$statusChanged : boolean

Boolean indicating if this plugin was ever enabled/disabled manually

Type

boolean

$dependsOn

$dependsOn : array<mixed,string>

List of plugins which this plugin depends on

Type

array<mixed,string>

$pico

$pico : \Pico

Current instance of Pico

Type

\Pico

$dependants

$dependants : array<mixed,object>

List of plugin which depend on this plugin

Type

array<mixed,object>

Methods

__construct()

__construct(\Pico  $pico) 

Constructs a new instance of a Pico plugin

Parameters

\Pico $pico

current instance of Pico

handleEvent()

handleEvent(string  $eventName, array  $params) : void

Handles a event that was triggered by Pico

Parameters

string $eventName

name of the triggered event

array $params

passed parameters

setEnabled()

setEnabled(boolean  $enabled, boolean  $recursive = true, boolean  $auto = false) : void

Enables or disables this plugin

Parameters

boolean $enabled

enable (true) or disable (false) this plugin

boolean $recursive

when true, enable or disable recursively In other words, if you enable a plugin, all required plugins are enabled, too. When disabling a plugin, all depending plugins are disabled likewise. Recursive operations are only performed as long as a plugin wasn't enabled/disabled manually. This parameter is optional and defaults to true.

boolean $auto

enable or disable to fulfill a dependency This parameter is optional and defaults to false.

isEnabled()

isEnabled() : boolean

Returns true if this plugin is enabled, false otherwise

Returns

boolean —

plugin is enabled (true) or disabled (false)

isStatusChanged()

isStatusChanged() : boolean

Returns true if the plugin was ever enabled/disabled manually

Returns

boolean —

plugin is in its default state (true), false otherwise

getPico()

getPico() : \Pico

Returns the plugins instance of Pico

Returns

\Pico

the plugins instance of Pico

__call()

__call(string  $methodName, array  $params) : mixed

Passes all not satisfiable method calls to Pico

Parameters

string $methodName

name of the method to call

array $params

parameters to pass

Returns

mixed —

return value of the called method

getDependencies()

getDependencies() : array<mixed,string>

Returns a list of names of plugins required by this plugin

Returns

array<mixed,string> —

required plugins

getDependants()

getDependants() : array<mixed,object>

Returns a list of plugins which depend on this plugin

Returns

array<mixed,object> —

dependant plugins

checkDependencies()

checkDependencies(boolean  $recursive) : void

Enables all plugins which this plugin depends on

Parameters

boolean $recursive

enable required plugins automatically

Throws

\RuntimeException

thrown when a dependency fails

checkDependants()

checkDependants(boolean  $recursive) : void

Disables all plugins which depend on this plugin

Parameters

boolean $recursive

disabled dependant plugins automatically

Throws

\RuntimeException

thrown when a dependency fails