Passed
Push — master ( dbe719...3b749c )
by Francis
01:23
created
libraries/RefactorCI.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@  discard block
 block discarded – undo
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,30 +55,30 @@  discard block
 block discarded – undo
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
         
70 70
       }
71 71
     }
72 72
     // Inflate Array
73 73
     if (isset($rule['inflate_array'])) {
74
-      foreach($rule['inflate_array'] as $field => $data) {
74
+      foreach ($rule['inflate_array'] as $field => $data) {
75 75
         $ids = json_decode($object[$field]);
76 76
         if (is_scalar($ids)) {
77 77
           // JSON Array wasn't supplied. Let's treat it as a scaler ID.
78 78
           $this->ci->db->where($this->primaryKey, $ids);
79 79
           $query = $this->ci->db->get($data['table']);
80 80
           if ($query->num_rows() == 0) {
81
-            $object[$field] = json_encode (json_decode ("{}"));
81
+            $object[$field] = json_encode(json_decode("{}"));
82 82
             continue;
83 83
           }
84 84
           $object[$field] = $query->result_array()[0];
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
         }
88 88
         $object[$field] = [];
89 89
         if ($ids == null) return;
90
-        foreach($ids as $id) {
90
+        foreach ($ids as $id) {
91 91
           $this->ci->db->where($this->primaryKey, $id);
92 92
           $query = $this->ci->db->get($data['table']);
93 93
           if ($query->num_rows() == 0) {
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
    *                       associative array.
108 108
    */
109 109
   private function unset_values(array &$object, &$rule):void {
110
-    foreach($rule['unset'] as $key) {
110
+    foreach ($rule['unset'] as $key) {
111 111
       unset($object[$key]);
112 112
     }
113 113
   }
Please login to merge, or discard this patch.