@@ -16,9 +16,9 @@ |
||
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); |
@@ -16,11 +16,11 @@ |
||
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); |
@@ -73,7 +73,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | } |
56 | 56 | |
57 | 57 | if (is_null($table)) { |
58 | - $this->setTable(get_class($this)."-table"); |
|
58 | + $this->setTable(get_class($this) . "-table"); |
|
59 | 59 | } else { |
60 | 60 | $this->setTable($table); |
61 | 61 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | public function __set($property, $value) |
87 | 87 | { |
88 | - if (! is_scalar($value)) { |
|
88 | + if (!is_scalar($value)) { |
|
89 | 89 | throw new AssignmentException("{$value} is not a scalar value. Only scalar values can be assigned to the {$property} property."); |
90 | 90 | } |
91 | 91 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | */ |
106 | 106 | public static function destroy($number) |
107 | 107 | { |
108 | - if (! is_int($number)) { |
|
108 | + if (!is_int($number)) { |
|
109 | 109 | throw new InvalidArgumentException("The parameter {$number} is not an integer. An integer is required instead."); |
110 | 110 | } |
111 | 111 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | */ |
126 | 126 | public static function find($number) |
127 | 127 | { |
128 | - if (! is_int($number)) { |
|
128 | + if (!is_int($number)) { |
|
129 | 129 | throw new InvalidArgumentException("The parameter {$number} is not an integer. An integer is required instead."); |
130 | 130 | } |
131 | 131 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | */ |
172 | 172 | public function save() |
173 | 173 | { |
174 | - if (! $this->hasAttributes()) { |
|
174 | + if (!$this->hasAttributes()) { |
|
175 | 175 | throw new RuntimeException("{get_class($this)} model has nothing to persist to the database."); |
176 | 176 | } |
177 | 177 |