Passed
Push — main ( 632f8e...e54bd0 )
by Pranjal
07:07
created
src/Model.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
      */
33 33
     public function __set(string $key, mixed $val): void
34 34
     {
35
-       $this->set($key,$val);
35
+        $this->set($key,$val);
36 36
     }
37 37
 
38 38
     public function set(string $key,mixed $val): void
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
     public function __get(string $key): mixed
72 72
     {
73
-         return $this->get($key);  
73
+            return $this->get($key);  
74 74
     }
75 75
 
76 76
     public function get(string $key){
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
      */
127 127
     public function __isset(string $key): bool
128 128
     {
129
-       return $this->isset($key);
129
+        return $this->isset($key);
130 130
     }
131 131
 
132 132
     /**
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -32,10 +32,10 @@  discard block
 block discarded – undo
32 32
      */
33 33
     public function __set(string $key, mixed $val): void
34 34
     {
35
-       $this->set($key,$val);
35
+       $this->set($key, $val);
36 36
     }
37 37
 
38
-    public function set(string $key,mixed $val): void
38
+    public function set(string $key, mixed $val): void
39 39
     {
40 40
                 //bug: fix issue with bool storage
41 41
                 if (gettype($val) == 'boolean') {
@@ -73,23 +73,23 @@  discard block
 block discarded – undo
73 73
          return $this->get($key);  
74 74
     }
75 75
 
76
-    public function get(string $key){
76
+    public function get(string $key) {
77 77
 
78 78
         if (preg_match('/[A-Z]/', $key)) {
79 79
             $parts = preg_split('/(?=[A-Z])/', $key, -1, PREG_SPLIT_NO_EMPTY);
80 80
             if (strtolower($parts[0]) == 'own') {
81
-                if (strtolower($parts[2])  == 'list') {
82
-                    return $this->db->find(strtolower($parts[1]))->where($this->getName() . '_id = "' . $this->_id.'"')->get();
81
+                if (strtolower($parts[2]) == 'list') {
82
+                    return $this->db->find(strtolower($parts[1]))->where($this->getName().'_id = "'.$this->_id.'"')->get();
83 83
                 }
84 84
             }
85 85
             if (strtolower($parts[0]) == 'shared') {
86
-                if (strtolower($parts[2])  == 'list') {
86
+                if (strtolower($parts[2]) == 'list') {
87 87
                     $rel_table = $this->db->getTableManager()->tableExists($this->table.'_'.strtolower($parts[1])) ? $this->table.'_'.strtolower($parts[1]) : strtolower($parts[1]).'_'.$this->table;
88
-                    $relations = $this->db->find($rel_table)->where($this->getName() . '_id = "' . $this->_id.'"')->get();
88
+                    $relations = $this->db->find($rel_table)->where($this->getName().'_id = "'.$this->_id.'"')->get();
89 89
                     $rel_ids = '';
90 90
                     foreach ($relations as $relation) {
91
-                        $key = strtolower($parts[1]) . '_id';
92
-                        $rel_ids .= "'".$relation->$key . "',";
91
+                        $key = strtolower($parts[1]).'_id';
92
+                        $rel_ids .= "'".$relation->$key."',";
93 93
                     }
94 94
                     $rel_ids = substr($rel_ids, 0, -1);
95 95
                     return $this->db->find(strtolower($parts[1]))->where('id IN ('.$rel_ids.')')->get();
Please login to merge, or discard this patch.
src/Database.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
         
28 28
     }
29 29
 
30
-    public function setManagers(TableManager $tableManager, RecordManager $recordManager, ModelManager $modelManager){
30
+    public function setManagers(TableManager $tableManager, RecordManager $recordManager, ModelManager $modelManager) {
31 31
         $this->tableManager = $tableManager;
32 32
         $this->recordManager = $recordManager;
33 33
         $this->modelManager = $modelManager;
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      * @param array $params
42 42
      * @return integer
43 43
      */
44
-    public function exec(string $sql, array $params=array()): int
44
+    public function exec(string $sql, array $params = array()): int
45 45
     {
46 46
         return  $this->connection->executeStatement($sql, $params);
47 47
     }
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      * @param array $params
54 54
      * @return array
55 55
      */
56
-    public function getAll(string $sql, array $params=[]): array
56
+    public function getAll(string $sql, array $params = []): array
57 57
     {
58 58
         return  $this->connection->executeQuery($sql, $params)->fetchAllAssociative();
59 59
     }
@@ -233,11 +233,11 @@  discard block
 block discarded – undo
233 233
      * @param mixed|null $id
234 234
      * @return mixed
235 235
      */
236
-    public function get(String $table,mixed $id = null) : Model|Collection
236
+    public function get(String $table, mixed $id = null) : Model | Collection
237 237
     {
238 238
         // For backward compatibility reason
239
-        if($id != null){
240
-            return $this->getOne($table,$id);
239
+        if ($id != null) {
240
+            return $this->getOne($table, $id);
241 241
         }
242 242
 
243 243
         return $this->recordManager->getAll($table);
Please login to merge, or discard this patch.