Commit 4488a462 authored by Sylvain's avatar Sylvain

Ajout d'un helper

parent b5b77d7a
......@@ -29,10 +29,10 @@ class Dynamik
public function getConditionalValue(array $data)
{
$val = $this->getValue($data['value']);
$operator = $data['operator'];
$true = $data['true'];
$operator = data_get($data, 'operator', '==');
$true = data_get($data, 'true', true);
$comparator = $data['comparator'];
$false = $data['false'];
$false = data_get($data, 'false');
switch ($operator) {
case '==' :
......
......@@ -12,3 +12,19 @@ if ( !function_exists('is_indexed_array')) {
return array_keys($array) === range(0, count($array) - 1);
}
}
if ( !function_exists('array_keys_exists')) {
/**
* Test si plusieurs clefs sont présentes dans un tableau
*
* @param array $keys
* @param array $arr
* @return boolean
*/
function array_keys_exists(array $keys, array $arr): bool
{
return !array_diff_key(array_flip($keys), $arr);
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment