public function getParameter($paramName, $namespace = null, $scope = null)
{
$namespace = $namespace ?: $this->defaultNamespace;
$scope = $scope ?: $this->defaultScope;
$triedScopes = array();
// Global scope
$globalScopeParamName = "{$namespace}." . self::SCOPE_GLOBAL . ".{$paramName}";
if ($this->container->hasParameter($globalScopeParamName)) {
return $this->container->getParameter($globalScopeParamName);
}
$triedScopes[] = self::SCOPE_GLOBAL;
unset($globalScopeParamName);
// Relative scope, siteaccess wise
$relativeScopeParamName = "{$namespace}.{$scope}.{$paramName}";
if ($this->container->hasParameter($relativeScopeParamName)) {
return $this->container->getParameter($relativeScopeParamName);
}
$triedScopes[] = $this->defaultScope;
unset($relativeScopeParamName);
// Relative scope, siteaccess group wise
if (isset($this->groupsBySiteAccess[$scope])) {
foreach ($this->groupsBySiteAccess[$scope] as $groupName) {
$relativeScopeParamName = "{$namespace}.{$groupName}.{$paramName}";
if ($this->container->hasParameter($relativeScopeParamName)) {
return $this->container->getParameter($relativeScopeParamName);
}
}
}
// Default scope
$defaultScopeParamName = "{$namespace}." . self::SCOPE_DEFAULT . ".{$paramName}";
if ($this->container->hasParameter($defaultScopeParamName)) {
return $this->container->getParameter($defaultScopeParamName);
}
$triedScopes[] = $this->defaultNamespace;
unset($defaultScopeParamName);
// Undefined parameter
switch ($this->undefinedStrategy) {
case self::UNDEFINED_STRATEGY_NULL:
return null;
case self::UNDEFINED_STRATEGY_EXCEPTION:
default:
throw new ParameterNotFoundException($paramName, $namespace, $triedScopes);
}
}