Passed
Pull Request — main (#13)
by
unknown
12:19 queued 10:24
created
src/Model.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -66,18 +66,18 @@
 block discarded – undo
66 66
         if (preg_match('/[A-Z]/', $key)) {
67 67
             $parts = preg_split('/(?=[A-Z])/', $key, -1, PREG_SPLIT_NO_EMPTY);
68 68
             if (strtolower($parts[0]) == 'own') {
69
-                if (strtolower($parts[2])  == 'list') {
70
-                    return Database::getInstance()->find(strtolower($parts[1]))->where($this->getName() . '_id = "' . $this->_id.'"')->get();
69
+                if (strtolower($parts[2]) == 'list') {
70
+                    return Database::getInstance()->find(strtolower($parts[1]))->where($this->getName().'_id = "'.$this->_id.'"')->get();
71 71
                 }
72 72
             }
73 73
             if (strtolower($parts[0]) == 'shared') {
74
-                if (strtolower($parts[2])  == 'list') {
74
+                if (strtolower($parts[2]) == 'list') {
75 75
                     $rel_table = Database::getInstance()->getTableManager()->tableExists($this->table.'_'.strtolower($parts[1])) ? $this->table.'_'.strtolower($parts[1]) : strtolower($parts[1]).'_'.$this->table;
76
-                    $relations = Database::getInstance()->find($rel_table)->where($this->getName() . '_id = "' . $this->_id.'"')->get();
76
+                    $relations = Database::getInstance()->find($rel_table)->where($this->getName().'_id = "'.$this->_id.'"')->get();
77 77
                     $rel_ids = '';
78 78
                     foreach ($relations as $relation) {
79
-                        $key = strtolower($parts[1]) . '_id';
80
-                        $rel_ids .= "'".$relation->$key . "',";
79
+                        $key = strtolower($parts[1]).'_id';
80
+                        $rel_ids .= "'".$relation->$key."',";
81 81
                     }
82 82
                     $rel_ids = substr($rel_ids, 0, -1);
83 83
                     return Database::getInstance()->find(strtolower($parts[1]))->where('id IN ('.$rel_ids.')')->get();
Please login to merge, or discard this patch.
src/Database.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
      * @param array $params
32 32
      * @return integer
33 33
      */
34
-    public function exec(string $sql, array $params=array()): int
34
+    public function exec(string $sql, array $params = array()): int
35 35
     {
36 36
         return  $this->connection->executeStatement($sql, $params);
37 37
     }
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
      * @param array $params
44 44
      * @return array
45 45
      */
46
-    public function getAll(string $sql, array $params=[]): array
46
+    public function getAll(string $sql, array $params = []): array
47 47
     {
48 48
         return  $this->connection->executeQuery($sql, $params)->fetchAllAssociative();
49 49
     }
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
      * @param mixed|null $id
225 225
      * @return mixed
226 226
      */
227
-    public function get(String $table, mixed $id=null) : mixed
227
+    public function get(String $table, mixed $id = null) : mixed
228 228
     {
229 229
         if (is_null($id)) {
230 230
             print('Get All Called \r \n');
Please login to merge, or discard this patch.
src/Manager/TableManager.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@
 block discarded – undo
58 58
     {
59 59
         $table = new Table($model->getName());
60 60
         if ($this->db->isUsingUUID()) {
61
-            $table->addColumn('id', 'string', ['length' => 36, 'notnull' => true,]);
61
+            $table->addColumn('id', 'string', ['length' => 36, 'notnull' => true, ]);
62 62
         } else {
63 63
             $table->addColumn("id", "integer", array("unsigned" => true, "autoincrement" => true));
64 64
         }
Please login to merge, or discard this patch.
src/Manager/RecordManager.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -67,18 +67,18 @@
 block discarded – undo
67 67
     }
68 68
 
69 69
     /**
70
-    * Get single record by id
71
-    *
72
-    * @param \Scrawler\Arca\Model $model
73
-    * @return \Scrawler\Arca\Model
74
-    */
70
+     * Get single record by id
71
+     *
72
+     * @param \Scrawler\Arca\Model $model
73
+     * @return \Scrawler\Arca\Model
74
+     */
75 75
     public function getById(Model $model, mixed $id): Model
76 76
     {
77 77
         $qb = new QueryBuilder($this->db->connection);
78 78
         $query =  $qb
79
-                 ->select('*')
80
-                 ->from($model->getName(), 't')
81
-                 ->where("t.id = '".$id."'");
79
+                    ->select('*')
80
+                    ->from($model->getName(), 't')
81
+                    ->where("t.id = '".$id."'");
82 82
         $result = $this->db->connection->executeQuery($query)->fetchAssociative();
83 83
         $result = $result ? $result : [];
84 84
         $model->setProperties($result)->setLoaded();
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@
 block discarded – undo
75 75
     public function getById(Model $model, mixed $id): Model
76 76
     {
77 77
         $qb = new QueryBuilder($this->db->connection);
78
-        $query =  $qb
78
+        $query = $qb
79 79
                  ->select('*')
80 80
                  ->from($model->getName(), 't')
81 81
                  ->where("t.id = '".$id."'");
Please login to merge, or discard this patch.