Completed
Branch master (992d7e)
by
unknown
20:36
created
src/Connections/MySqlConnection.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,9 +16,9 @@
 block discarded – undo
16 16
     {
17 17
         $this->useDbEnv();
18 18
 
19
-        $dsn = 'mysql:host='.$this->_host;
20
-        $dsn .= (isset($this->_port)) ? ';port='.$this->_port : '';
21
-        $dsn .= ';dbname='.$this->_database;
19
+        $dsn = 'mysql:host=' . $this->_host;
20
+        $dsn .= (isset($this->_port)) ? ';port=' . $this->_port : '';
21
+        $dsn .= ';dbname=' . $this->_database;
22 22
 
23 23
         try {
24 24
             $this->_pdo = new PDO($dsn, $this->_username, $this->_password);
Please login to merge, or discard this patch.
Unused Use Statements   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,10 +2,10 @@
 block discarded – undo
2 2
 
3 3
 namespace Opeyemiabiodun\PotatoORM\Connections;
4 4
 
5
-use PDO;
6
-use PDOException;
7 5
 use InvalidArgumentException;
8 6
 use Opeyemiabiodun\PotatoORM\Connections\Connection;
7
+use PDO;
8
+use PDOException;
9 9
 
10 10
 final class MySqlConnection extends Connection
11 11
 {
Please login to merge, or discard this patch.
src/Connections/PgSqlConnection.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -16,11 +16,11 @@
 block discarded – undo
16 16
     {
17 17
         $this->useDbEnv();
18 18
 
19
-        $dsn = 'pgsql:host='.$this->_host;
20
-        $dsn .= (isset($this->_port)) ? ';port='.$this->_port : '';
21
-        $dsn .= ';dbname='.$this->_database;
22
-        $dsn .= ';user='.$this->_username;
23
-        $dsn .= ';password='.$this->_password;
19
+        $dsn = 'pgsql:host=' . $this->_host;
20
+        $dsn .= (isset($this->_port)) ? ';port=' . $this->_port : '';
21
+        $dsn .= ';dbname=' . $this->_database;
22
+        $dsn .= ';user=' . $this->_username;
23
+        $dsn .= ';password=' . $this->_password;
24 24
 
25 25
         try {
26 26
             $this->_pdo = new PDO($dsn);
Please login to merge, or discard this patch.
Unused Use Statements   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,10 +2,10 @@
 block discarded – undo
2 2
 
3 3
 namespace Opeyemiabiodun\PotatoORM\Connections;
4 4
 
5
-use PDO;
6
-use PDOException;
7 5
 use InvalidArgumentException;
8 6
 use Opeyemiabiodun\PotatoORM\Connections\Connection;
7
+use PDO;
8
+use PDOException;
9 9
 
10 10
 final class PgSqlConnection extends Connection
11 11
 {
Please login to merge, or discard this patch.
src/Connections/Connection.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
      */
74 74
     protected function loadDbEnv()
75 75
     {
76
-        $dotenv = new Dotenv(__DIR__.'/../..');
76
+        $dotenv = new Dotenv(__DIR__ . '/../..');
77 77
         $dotenv->required(['DB_HOST', 'DB_DATABASE', 'DB_USERNAME', 'DB_PASSWORD'])->notEmpty();
78 78
         $dotenv->required(['DB_PORT']);
79 79
         $dotenv->load();
@@ -121,9 +121,9 @@  discard block
 block discarded – undo
121 121
         $sql = "INSERT INTO {$table} (";
122 122
         foreach ($record as $key => $value) {
123 123
             if ($count > 1) {
124
-                $sql = $sql."{$key}, ";
124
+                $sql = $sql . "{$key}, ";
125 125
             } else {
126
-                $sql = $sql."{$key}) ";
126
+                $sql = $sql . "{$key}) ";
127 127
             }
128 128
             $count--;
129 129
         }
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
         $sql .= "VALUES (";
134 134
         foreach ($record as $key => $value) {
135 135
             if ($count > 1) {
136
-                $sql = $sql."{$value}, ";
136
+                $sql = $sql . "{$value}, ";
137 137
             } else {
138
-                $sql = $sql."{$value}) ";
138
+                $sql = $sql . "{$value}) ";
139 139
             }
140 140
             $count--;
141 141
         }
@@ -237,9 +237,9 @@  discard block
 block discarded – undo
237 237
         $sql = "UPDATE {$table} SET ";
238 238
         foreach ($record as $key => $value) {
239 239
             if ($count > 1) {
240
-                $sql = $sql."{$key}={$value}, ";
240
+                $sql = $sql . "{$key}={$value}, ";
241 241
             } else {
242
-                $sql = $sql."{$key}={$value} ";
242
+                $sql = $sql . "{$key}={$value} ";
243 243
             }
244 244
             $count--;
245 245
         }
Please login to merge, or discard this patch.
Unused Use Statements   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,10 +2,10 @@
 block discarded – undo
2 2
 
3 3
 namespace Opeyemiabiodun\PotatoORM\Connections;
4 4
 
5
-use Exception;
6 5
 use Dotenv\Dotenv;
7
-use RuntimeException;
6
+use Exception;
8 7
 use InvalidArgumentException;
8
+use RuntimeException;
9 9
 
10 10
 abstract class Connection
11 11
 {
Please login to merge, or discard this patch.
src/Models/Model.php 2 patches
Unused Use Statements   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,12 +2,12 @@
 block discarded – undo
2 2
 
3 3
 namespace Opeyemiabiodun\PotatoORM\Models;
4 4
 
5
-use RuntimeException;
6 5
 use InvalidArgumentException;
7 6
 use Opeyemiabiodun\PotatoORM\Connections\Connection;
8 7
 use Opeyemiabiodun\PotatoORM\Connections\PgSqlConnection;
9 8
 use Opeyemiabiodun\PotatoORM\Exceptions\AssignmentException;
10 9
 use Opeyemiabiodun\PotatoORM\Exceptions\PropertyNotFoundException;
10
+use RuntimeException;
11 11
 
12 12
 trait Model
13 13
 {
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
      */
85 85
     public function __set($property, $value)
86 86
     {
87
-        if (! is_scalar($value)) {
87
+        if (!is_scalar($value)) {
88 88
             throw new AssignmentException("{$value} is not a scalar value. Only scalar values can be assigned to the {$property} property.");
89 89
         }
90 90
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
      */
105 105
     public static function destroy($number)
106 106
     {
107
-        if (! is_int($number)) {
107
+        if (!is_int($number)) {
108 108
             throw new InvalidArgumentException("The parameter {$number} is not an integer. An integer is required instead.");
109 109
         }
110 110
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
      */
125 125
     public static function find($number)
126 126
     {
127
-        if (! is_int($number)) {
127
+        if (!is_int($number)) {
128 128
             throw new InvalidArgumentException("The parameter {$number} is not an integer. An integer is required instead.");
129 129
         }
130 130
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
         $hasAttributes = false;
156 156
 
157 157
         foreach ($this->_attributes as $key => $value) {
158
-            if (! is_null($value)) {
158
+            if (!is_null($value)) {
159 159
                 $hasAttributes = true;
160 160
             }
161 161
         }
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
      */
171 171
     public function save()
172 172
     {
173
-        if (! $this->hasAttributes()) {
173
+        if (!$this->hasAttributes()) {
174 174
             throw new RuntimeException("{get_class($this)} model has nothing to persist to the database.");
175 175
         }
176 176
 
Please login to merge, or discard this patch.
src/Models/User.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,5 +6,5 @@
 block discarded – undo
6 6
 
7 7
 class User
8 8
 {
9
-	use Model;
9
+    use Model;
10 10
 }
11 11
\ No newline at end of file
Please login to merge, or discard this patch.