public static function elementFinder($needle, $haystack, $delimiter = '.')
{
$break = strpos($needle, $delimiter);
$key = $break === false ? $needle : substr($needle, 0, $break);
if (isset($haystack[$key])) {
if ($key == $needle) {
return $haystack[$key];
}
return static::elementFinder(substr($needle, $break + 1), $haystack[$key]);
} else {
return null;
}
}
/** * Set portal config. * * @throws InvalidArgumentException */ protected function setConfig() { $config = $this->yii->params['portal']; if (!$config) { throw new InvalidArgumentException('Missing portal configuration for ' . __CLASS__); } foreach (static::$required_config_keys as $k) { if (Helper::elementFinder($k, $config) === null) { throw new InvalidArgumentException('Missing required config parameter for ' . __CLASS__); } } $this->config = $config; }