@@ -11,8 +11,8 @@ discard block |
||
11 | 11 | |
12 | 12 | private $primaryKey; |
13 | 13 | |
14 | - function __construct($params=null) { |
|
15 | - $this->ci =& get_instance(); |
|
14 | + function __construct($params = null) { |
|
15 | + $this->ci = & get_instance(); |
|
16 | 16 | $this->ci->load->config("refactor", false, true); |
17 | 17 | $this->init($params == null ? [] : $params); |
18 | 18 | } |
@@ -38,20 +38,20 @@ discard block |
||
38 | 38 | } |
39 | 39 | // Bools |
40 | 40 | if (isset($rule['bools'])) { |
41 | - foreach($rule['bools'] as $boolKey) { |
|
41 | + foreach ($rule['bools'] as $boolKey) { |
|
42 | 42 | $object[$boolKey] = $object[$boolKey] == 1 || $object[$boolKey] == 'true'; |
43 | 43 | } |
44 | 44 | } |
45 | 45 | // Objects |
46 | 46 | if (isset($rule['objects'])) { |
47 | - foreach($rule['objects'] as $field => $data) { |
|
47 | + foreach ($rule['objects'] as $field => $data) { |
|
48 | 48 | $ids = json_decode($object[$field]); |
49 | 49 | if (is_scalar($ids)) { |
50 | 50 | // JSON Array wasn't supplied. Let's treat it as a scaler ID. |
51 | 51 | $this->ci->db->where($this->primaryKey, $ids); |
52 | 52 | $query = $this->ci->db->get($data['table']); |
53 | 53 | if ($query->num_rows() == 0) { |
54 | - $object[$field] = json_encode (json_decode ("{}")); |
|
54 | + $object[$field] = json_encode(json_decode("{}")); |
|
55 | 55 | continue; |
56 | 56 | } |
57 | 57 | $object[$field] = $query->result_array()[0]; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | continue; |
60 | 60 | } |
61 | 61 | $object[$field] = []; |
62 | - foreach($ids as $id) { |
|
62 | + foreach ($ids as $id) { |
|
63 | 63 | $this->ci->db->where($this->primaryKey, $id); |
64 | 64 | $query = $this->ci->db->get($data['table']); |
65 | 65 | if ($query->num_rows() == 0) { |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * associative array. |
80 | 80 | */ |
81 | 81 | private function unset_values(array &$object, &$rule):void { |
82 | - foreach($rule['unset'] as $key) { |
|
82 | + foreach ($rule['unset'] as $key) { |
|
83 | 83 | unset($object[$key]); |
84 | 84 | } |
85 | 85 | } |