getPluginParameter()
getPluginParameter(string $parameter, boolean $parseArray = true) : array|boolean|string|\stdClass
Gets a plugin parameter from Drone
The plugin can return an object if the key is complex ( eg: nested )
Getting a simple value :
// Get the build :
$build = new \DronePluginSdk\Build();
// Get some settings :
var_dump($build->getPluginParameter('my_simple_parameter'));
Result
[test:L0:0s] string(8) "World"
Getting a complex value :
// Get the build :
$build = new \DronePluginSdk\Build();
// Get some settings :
var_dump($build->getPluginParameter('my_parameter'));
Result
[test:L0:0s] object(stdClass)#2 (5) {
[test:L1:0s] ["a_boolean"]=>
[test:L2:0s] bool(true)
[test:L3:0s] ["also_a_bool"]=>
[test:L4:0s] bool(true)
[test:L5:0s] ["another_level"]=>
[test:L6:0s] array(2) {
[test:L7:0s] [0]=>
[test:L8:0s] string(5) "item1"
[test:L9:0s] [1]=>
[test:L10:0s] string(5) "item2"
[test:L11:0s] }
[test:L12:0s] ["something"]=>
[test:L13:0s] bool(true)
[test:L14:0s] ["something_else"]=>
[test:L15:0s] string(8) "probably"
[test:L16:0s] }
Parameters
string | $parameter | The parameter name as passed in the .drone.yml |
boolean | $parseArray | If set to false, |
Returns
array|boolean|string|\stdClass —Parameter value, false
if not found