Skip to content

Commit f05eafe

Browse files
Apply fixes from StyleCI
1 parent 6e3335c commit f05eafe

File tree

2 files changed

+46
-35
lines changed

2 files changed

+46
-35
lines changed

src/RestController.php

Lines changed: 35 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class RestController extends \CI_Controller
3333
protected $methods = [];
3434

3535
/**
36-
* Defines https status
36+
* Defines https status.
3737
*/
3838
protected $http_status = [];
3939

@@ -448,10 +448,10 @@ private function do_auth($method = false)
448448
*/
449449
private function get_local_config($config_file)
450450
{
451-
if ( file_exists(APPPATH . 'config/' . $config_file . '.php') ) {
451+
if (file_exists(APPPATH.'config/'.$config_file.'.php')) {
452452
$this->load->config($config_file, false);
453453
} else {
454-
if ( file_exists(__DIR__.'/'.$config_file.'.php') ) {
454+
if (file_exists(__DIR__.'/'.$config_file.'.php')) {
455455
$config = [];
456456
include __DIR__.'/'.$config_file.'.php';
457457
foreach ($config as $key => $value) {
@@ -951,15 +951,17 @@ protected function _log_request($authorized = false)
951951
// Insert the request into the log table
952952
$is_inserted = $this->rest->db
953953
->insert(
954-
$this->config->item('rest_logs_table'), [
955-
'uri' => $this->uri->uri_string(),
956-
'method' => $this->request->method,
957-
'params' => $this->_args ? ($this->config->item('rest_logs_json_params') === true ? json_encode($this->_args) : serialize($this->_args)) : null,
958-
'api_key' => isset($this->rest->key) ? $this->rest->key : '',
959-
'ip_address' => $this->input->ip_address(),
960-
'time' => time(),
961-
'authorized' => $authorized,
962-
]);
954+
$this->config->item('rest_logs_table'),
955+
[
956+
'uri' => $this->uri->uri_string(),
957+
'method' => $this->request->method,
958+
'params' => $this->_args ? ($this->config->item('rest_logs_json_params') === true ? json_encode($this->_args) : serialize($this->_args)) : null,
959+
'api_key' => isset($this->rest->key) ? $this->rest->key : '',
960+
'ip_address' => $this->input->ip_address(),
961+
'time' => time(),
962+
'authorized' => $authorized,
963+
]
964+
);
963965

964966
// Get the last insert id to update at a later stage of the request
965967
$this->_insert_id = $this->rest->db->insert_id();
@@ -1710,7 +1712,7 @@ protected function _check_php_session()
17101712
if ($this->config->item('rest_ip_whitelist_enabled')) {
17111713
$this->_check_whitelist_auth();
17121714
}
1713-
1715+
17141716
// Load library session of CodeIgniter
17151717
$this->load->library('session');
17161718

@@ -1877,7 +1879,8 @@ protected function _force_login($nonce = '')
18771879
header(
18781880
'WWW-Authenticate: Digest realm="'.$rest_realm
18791881
.'", qop="auth", nonce="'.$nonce
1880-
.'", opaque="'.md5($rest_realm).'"');
1882+
.'", opaque="'.md5($rest_realm).'"'
1883+
);
18811884
}
18821885

18831886
if ($this->config->item('strict_api_and_auth') === true) {
@@ -1907,9 +1910,12 @@ protected function _log_access_time()
19071910
$payload['rtime'] = $this->_end_rtime - $this->_start_rtime;
19081911

19091912
return $this->rest->db->update(
1910-
$this->config->item('rest_logs_table'), $payload, [
1911-
'id' => $this->_insert_id,
1912-
]);
1913+
$this->config->item('rest_logs_table'),
1914+
$payload,
1915+
[
1916+
'id' => $this->_insert_id,
1917+
]
1918+
);
19131919
}
19141920

19151921
/**
@@ -1930,9 +1936,12 @@ protected function _log_response_code($http_code)
19301936
$payload['response_code'] = $http_code;
19311937

19321938
return $this->rest->db->update(
1933-
$this->config->item('rest_logs_table'), $payload, [
1934-
'id' => $this->_insert_id,
1935-
]);
1939+
$this->config->item('rest_logs_table'),
1940+
$payload,
1941+
[
1942+
'id' => $this->_insert_id,
1943+
]
1944+
);
19361945
}
19371946

19381947
/**
@@ -1949,10 +1958,12 @@ protected function _check_access()
19491958

19501959
// Fetch controller based on path and controller name
19511960
$controller = implode(
1952-
'/', [
1953-
$this->router->directory,
1954-
$this->router->class,
1955-
]);
1961+
'/',
1962+
[
1963+
$this->router->directory,
1964+
$this->router->class,
1965+
]
1966+
);
19561967

19571968
// Remove any double slashes for safety
19581969
$controller = str_replace('//', '/', $controller);

src/rest.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -556,11 +556,11 @@
556556
|
557557
*/
558558
$config['allowed_cors_headers'] = [
559-
'Origin',
560-
'X-Requested-With',
561-
'Content-Type',
562-
'Accept',
563-
'Access-Control-Request-Method',
559+
'Origin',
560+
'X-Requested-With',
561+
'Content-Type',
562+
'Accept',
563+
'Access-Control-Request-Method',
564564
];
565565

566566
/*
@@ -572,12 +572,12 @@
572572
|
573573
*/
574574
$config['allowed_cors_methods'] = [
575-
'GET',
576-
'POST',
577-
'OPTIONS',
578-
'PUT',
579-
'PATCH',
580-
'DELETE',
575+
'GET',
576+
'POST',
577+
'OPTIONS',
578+
'PUT',
579+
'PATCH',
580+
'DELETE',
581581
];
582582

583583
/*

0 commit comments

Comments
 (0)