@@ -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 | } |
@@ -55,24 +55,24 @@ discard block |
||
| 55 | 55 | } |
| 56 | 56 | // Bools |
| 57 | 57 | if (isset($rule['bools'])) { |
| 58 | - foreach($rule['bools'] as $boolKey) { |
|
| 58 | + foreach ($rule['bools'] as $boolKey) { |
|
| 59 | 59 | $object[$boolKey] = $object[$boolKey] == 1 || $object[$boolKey] == 'true'; |
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | // Cast |
| 63 | - if (isset($rule['cast'])) { |
|
| 63 | + if (isset($rule['cast'])) { |
|
| 64 | 64 | $this->cast_fields($object, $rule); |
| 65 | 65 | } |
| 66 | 66 | // Inflate |
| 67 | 67 | if (isset($rule['inflate'])) { |
| 68 | - foreach($rule['inflate'] as $field => $data) { |
|
| 68 | + foreach ($rule['inflate'] as $field => $data) { |
|
| 69 | 69 | $ids = json_decode($object[$field]); |
| 70 | 70 | if (is_scalar($ids)) { |
| 71 | 71 | // JSON Array wasn't supplied. Let's treat it as a scaler ID. |
| 72 | 72 | $this->ci->db->where($this->primaryKey, $ids); |
| 73 | 73 | $query = $this->ci->db->get($data['table']); |
| 74 | 74 | if ($query->num_rows() == 0) { |
| 75 | - $object[$field] = json_encode (json_decode ("{}")); |
|
| 75 | + $object[$field] = json_encode(json_decode("{}")); |
|
| 76 | 76 | continue; |
| 77 | 77 | } |
| 78 | 78 | $object[$field] = $query->result_array()[0]; |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | } |
| 82 | 82 | $object[$field] = []; |
| 83 | 83 | if ($ids == null) return; |
| 84 | - foreach($ids as $id) { |
|
| 84 | + foreach ($ids as $id) { |
|
| 85 | 85 | $this->ci->db->where($this->primaryKey, $id); |
| 86 | 86 | $query = $this->ci->db->get($data['table']); |
| 87 | 87 | if ($query->num_rows() == 0) { |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | * associative array. |
| 102 | 102 | */ |
| 103 | 103 | private function unset_values(array &$object, &$rule):void { |
| 104 | - foreach($rule['unset'] as $key) { |
|
| 104 | + foreach ($rule['unset'] as $key) { |
|
| 105 | 105 | unset($object[$key]); |
| 106 | 106 | } |
| 107 | 107 | } |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | * @covers JWT::__construct |
| 21 | 21 | */ |
| 22 | 22 | public static function setUpBeforeClass(): void { |
| 23 | - self::$ci =& get_instance(); |
|
| 23 | + self::$ci = & get_instance(); |
|
| 24 | 24 | } |
| 25 | 25 | /** |
| 26 | 26 | * [testLoadPackage description] |