private function searchMissedParameters(array $metadata)
{
//create a recursive iterator to loop over the array recursively
$iterator = new RecursiveIteratorIterator(
new RecursiveArrayIterator($metadata),
RecursiveIteratorIterator::SELF_FIRST
);
$parameters = [];
//loop over the iterator
foreach ($iterator as $key => $value) {
// go deeper - recursive chain
if (is_array($value)) {
continue;
}
if (preg_match(self::PARAMETER_PATTERN, $value, $output)) {
// add the current key if it's not a recursion
if ($iterator->getDepth() == 0) {
$parameters[$key] = 1;
}
//loop up the recursive chain
$recursiveKey = null;
for ($i = 0; $i < $iterator->getDepth(); $i++) {
$recursiveKey = "{$recursiveKey}.{$iterator->getSubIterator($i)->key()}";
}
if (null != $recursiveKey) {
$recursiveKey = ltrim("{$recursiveKey}.{$key}", ".");
$parameters[$recursiveKey] = 2;
}
}
}
return $parameters;
}