Passed
Push — master ( 5e7564...5686c5 )
by Francis
06:48
created
models/RESTModel.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -81,10 +81,14 @@  discard block
 block discarded – undo
81 81
       $this->db->or_where($this->users_username_column, $username);
82 82
     }
83 83
     $query = $this->db->get();
84
-    if ($query->num_rows() == 0) return false;
84
+    if ($query->num_rows() == 0) {
85
+     return false;
86
+    }
85 87
     // Authenticate.
86 88
     if (password_verify($password, $query->result()[0]->{$this->users_password_column})) {
87
-      if ($this->users_id_column != null) $context->userId = $query->result()[0]->{$this->users_id_column};
89
+      if ($this->users_id_column != null) {
90
+       $context->userId = $query->result()[0]->{$this->users_id_column};
91
+      }
88 92
       return true;
89 93
     }
90 94
     return false;
@@ -97,7 +101,9 @@  discard block
 block discarded – undo
97 101
    */
98 102
   public function getAPIKeyData(string $apiKey):?object {
99 103
     // Preliminary Check.
100
-    if ($this->api_key_table == null || $this->api_key_column == null) return null;
104
+    if ($this->api_key_table == null || $this->api_key_column == null) {
105
+     return null;
106
+    }
101 107
     // Query.
102 108
     $this->db->from($this->api_key_table);
103 109
     $this->db->where($this->api_key_column, $apiKey);
@@ -122,7 +128,9 @@  discard block
 block discarded – undo
122 128
   public function getLimitData(string $client, string $group):?array {
123 129
     $sql = 'SELECT count, start, (`start` + INTERVAL (1 - TIMESTAMPDIFF(HOUR, UTC_TIMESTAMP(), NOW())) HOUR) AS reset_epoch FROM rest_api_rate_limit WHERE client = ? AND _group = ?';
124 130
     $query = $this->db->query($sql, [$client, $group]);
125
-    if (!is_scalar($query) && $query->num_rows() > 0) return $query->result_array()[0];
131
+    if (!is_scalar($query) && $query->num_rows() > 0) {
132
+     return $query->result_array()[0];
133
+    }
126 134
     return null;
127 135
   }
128 136
   /**
Please login to merge, or discard this patch.