Skip to content

Commit 6f13a50

Browse files
committed
Refactor Core CodeIgniter
1 parent fac6aee commit 6f13a50

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

system/core/Config.php

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ public function __construct()
124124
* @param bool $fail_gracefully Whether to just return FALSE or display an error message
125125
* @return bool TRUE if the file was loaded correctly or FALSE on failure
126126
*/
127+
#[\ReturnTypeWillChange]
127128
public function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE)
128129
{
129130
$file = ($file === '') ? 'config' : str_replace('.php', '', $file);
@@ -174,12 +175,11 @@ public function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE
174175
}
175176
}
176177

177-
if ($loaded === TRUE)
178-
{
178+
if ($loaded === TRUE) {
179179
return TRUE;
180180
}
181-
elseif ($fail_gracefully === TRUE)
182-
{
181+
182+
if ($fail_gracefully === TRUE) {
183183
return FALSE;
184184
}
185185

@@ -219,7 +219,8 @@ public function slash_item($item)
219219
{
220220
return NULL;
221221
}
222-
elseif (trim($this->config[$item]) === '')
222+
223+
if (trim($this->config[$item]) === '')
223224
{
224225
return '';
225226
}
@@ -264,8 +265,7 @@ public function site_url($uri = '', $protocol = NULL)
264265

265266
$uri = $this->_uri_string($uri);
266267

267-
if ($this->item('enable_query_strings') === FALSE)
268-
{
268+
if ($this->item('enable_query_strings') === FALSE) {
269269
$suffix = isset($this->config['url_suffix']) ? $this->config['url_suffix'] : '';
270270

271271
if ($suffix !== '')
@@ -282,8 +282,8 @@ public function site_url($uri = '', $protocol = NULL)
282282

283283
return $base_url.$this->slash_item('index_page').$uri;
284284
}
285-
elseif (strpos($uri, '?') === FALSE)
286-
{
285+
286+
if (strpos($uri, '?') === FALSE) {
287287
$uri = '?'.$uri;
288288
}
289289

@@ -336,13 +336,12 @@ public function base_url($uri = '', $protocol = NULL)
336336
*/
337337
protected function _uri_string($uri)
338338
{
339-
if ($this->item('enable_query_strings') === FALSE)
340-
{
339+
if ($this->item('enable_query_strings') === FALSE) {
341340
is_array($uri) && $uri = implode('/', $uri);
342341
return ltrim($uri, '/');
343342
}
344-
elseif (is_array($uri))
345-
{
343+
344+
if (is_array($uri)) {
346345
return http_build_query($uri);
347346
}
348347

system/core/Exceptions.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ public function __construct()
100100
* @param int $line Line number
101101
* @return void
102102
*/
103+
#[\ReturnTypeWillChange]
103104
public function log_exception($severity, $message, $filepath, $line)
104105
{
105106
$severity = isset($this->levels[$severity]) ? $this->levels[$severity] : $severity;

system/core/Input.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,8 @@ public function __get($name)
928928
isset($this->_raw_input_stream) OR $this->_raw_input_stream = file_get_contents('php://input');
929929
return $this->_raw_input_stream;
930930
}
931-
elseif ($name === 'ip_address')
931+
932+
if ($name === 'ip_address')
932933
{
933934
return $this->ip_address;
934935
}

0 commit comments

Comments
 (0)