|
1 | 1 | <?php |
2 | 2 |
|
3 | | -declare(strict_types=1); |
4 | | - |
5 | 3 | /** |
6 | 4 | * This file is part of ILIAS, a powerful learning management system |
7 | 5 | * published by ILIAS open source e-Learning e.V. |
|
18 | 16 | * |
19 | 17 | *********************************************************************/ |
20 | 18 |
|
| 19 | +declare(strict_types=1); |
21 | 20 |
|
22 | 21 | use Monolog\Logger; |
23 | 22 | use Monolog\Handler\StreamHandler; |
@@ -127,31 +126,31 @@ public function initUser(string $a_login): void |
127 | 126 | */ |
128 | 127 | protected function isConsoleAvailable(): bool |
129 | 128 | { |
130 | | - if (ilContext::getType() != ilContext::CONTEXT_WEB) { |
| 129 | + if (ilContext::getType() !== ilContext::CONTEXT_WEB) { |
131 | 130 | return false; |
132 | 131 | } |
133 | | - if ( |
134 | | - $this->dic->isDependencyAvailable('ctrl') && $this->dic->ctrl()->isAsynch() || |
| 132 | + |
| 133 | + if (($this->dic->isDependencyAvailable('ctrl') && $this->dic->ctrl()->isAsynch()) || |
135 | 134 | ( |
136 | 135 | $this->dic->isDependencyAvailable('http') && |
137 | | - strtolower($this->dic->http()->request()->getServerParams()['HTTP_X_REQUESTED_WITH'] ?? '') === 'xmlhttprequest' |
| 136 | + strtolower( |
| 137 | + $this->dic->http()->request()->getServerParams()['HTTP_X_REQUESTED_WITH'] ?? '' |
| 138 | + ) === 'xmlhttprequest' |
138 | 139 | ) |
139 | 140 | ) { |
140 | 141 | return false; |
141 | 142 | } |
142 | 143 |
|
143 | | - if ( |
144 | | - $this->dic->isDependencyAvailable('http') && |
145 | | - strpos($this->dic->http()->request()->getServerParams()['HTTP_ACCEPT'], 'text/html') !== false |
146 | | - ) { |
| 144 | + if ($this->dic->isDependencyAvailable('http') && |
| 145 | + str_contains($this->dic->http()->request()->getServerParams()['HTTP_ACCEPT'] ?? '', 'text/html')) { |
147 | 146 | return true; |
148 | 147 | } |
149 | | - if ( |
150 | | - $this->dic->isDependencyAvailable('http') && |
151 | | - strpos($this->dic->http()->request()->getServerParams()['HTTP_ACCEPT'], 'application/json') !== false |
152 | | - ) { |
| 148 | + |
| 149 | + if ($this->dic->isDependencyAvailable('http') && |
| 150 | + str_contains($this->dic->http()->request()->getServerParams()['HTTP_ACCEPT'] ?? '', 'application/json')) { |
153 | 151 | return false; |
154 | 152 | } |
| 153 | + |
155 | 154 | return true; |
156 | 155 | } |
157 | 156 |
|
|
0 commit comments