* @deprecated 20.0.0
*/
class DIContainer extends SimpleContainer implements IAppContainer {
+ private string $appName;
/**
* @var array
* @param array $urlParams
* @param ServerContainer|null $server
*/
- public function __construct($appName, $urlParams = [], ServerContainer $server = null) {
+ public function __construct(string $appName, array $urlParams = [], ServerContainer $server = null) {
parent::__construct();
+ $this->appName = $appName;
$this['appName'] = $appName;
$this['urlParams'] = $urlParams;
}
public function query(string $name, bool $autoload = true) {
+ if ($name === 'AppName' || $name === 'appName') {
+ return $this->appName;
+ }
try {
return $this->queryNoFallback($name);
} catch (QueryException $firstException) {
if ($this->offsetExists($name)) {
return parent::query($name);
- } elseif ($this['AppName'] === 'settings' && strpos($name, 'OC\\Settings\\') === 0) {
+ } elseif ($this->appName === 'settings' && strpos($name, 'OC\\Settings\\') === 0) {
return parent::query($name);
- } elseif ($this['AppName'] === 'core' && strpos($name, 'OC\\Core\\') === 0) {
+ } elseif ($this->appName === 'core' && strpos($name, 'OC\\Core\\') === 0) {
return parent::query($name);
- } elseif (strpos($name, \OC\AppFramework\App::buildAppNamespace($this['AppName']) . '\\') === 0) {
+ } elseif (strpos($name, \OC\AppFramework\App::buildAppNamespace($this->appName) . '\\') === 0) {
return parent::query($name);
}