@@ -81,15 +81,15 @@ discard block |
||
81 | 81 | |
82 | 82 | $lowercased_word = strtolower($word); |
83 | 83 | |
84 | - foreach ($uncountable as $_uncountable){ |
|
85 | - if(substr($lowercased_word,(-1*strlen($_uncountable))) == $_uncountable){ |
|
84 | + foreach ($uncountable as $_uncountable) { |
|
85 | + if (substr($lowercased_word, (-1*strlen($_uncountable))) == $_uncountable) { |
|
86 | 86 | return $word; |
87 | 87 | } |
88 | 88 | } |
89 | 89 | |
90 | - foreach ($irregular as $_plural=> $_singular){ |
|
90 | + foreach ($irregular as $_plural=> $_singular) { |
|
91 | 91 | if (preg_match('/('.$_plural.')$/i', $word, $arr)) { |
92 | - return preg_replace('/('.$_plural.')$/i', substr($arr[0],0,1).substr($_singular,1), $word); |
|
92 | + return preg_replace('/('.$_plural.')$/i', substr($arr[0], 0, 1).substr($_singular, 1), $word); |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | */ |
112 | 112 | public function singularize($word) |
113 | 113 | { |
114 | - $singular = array ( |
|
114 | + $singular = array( |
|
115 | 115 | '/(quiz)zes$/i' => "$1", |
116 | 116 | '/(matr)ices$/i' => "$1ix", |
117 | 117 | '/(vert|ind)ices$/i' => "$1ex", |
@@ -152,15 +152,15 @@ discard block |
||
152 | 152 | 'move' => 'moves'); |
153 | 153 | |
154 | 154 | $lowercased_word = strtolower($word); |
155 | - foreach ($uncountable as $_uncountable){ |
|
156 | - if(substr($lowercased_word,(-1*strlen($_uncountable))) == $_uncountable){ |
|
155 | + foreach ($uncountable as $_uncountable) { |
|
156 | + if (substr($lowercased_word, (-1*strlen($_uncountable))) == $_uncountable) { |
|
157 | 157 | return $word; |
158 | 158 | } |
159 | 159 | } |
160 | 160 | |
161 | - foreach ($irregular as $_plural=> $_singular){ |
|
161 | + foreach ($irregular as $_plural=> $_singular) { |
|
162 | 162 | if (preg_match('/('.$_singular.')$/i', $word, $arr)) { |
163 | - return preg_replace('/('.$_singular.')$/i', substr($arr[0],0,1).substr($_plural,1), $word); |
|
163 | + return preg_replace('/('.$_singular.')$/i', substr($arr[0], 0, 1).substr($_plural, 1), $word); |
|
164 | 164 | } |
165 | 165 | } |
166 | 166 |
@@ -11,9 +11,9 @@ |
||
11 | 11 | |
12 | 12 | interface DatabaseQueryInterface |
13 | 13 | { |
14 | - public function checkTableExist($table, $con=NULL); |
|
14 | + public function checkTableExist($table, $con = NULL); |
|
15 | 15 | |
16 | - public static function checkTableName($table, $dbConnection=NULL); |
|
16 | + public static function checkTableName($table, $dbConnection = NULL); |
|
17 | 17 | |
18 | 18 | public static function selectQuery($tableName, $field, $value, $connection); |
19 | 19 |
@@ -25,6 +25,6 @@ |
||
25 | 25 | */ |
26 | 26 | public function errorMessage() |
27 | 27 | { |
28 | - return "Error: " . $this->getMessage(); |
|
28 | + return "Error: ".$this->getMessage(); |
|
29 | 29 | } |
30 | 30 | } |
31 | 31 | \ No newline at end of file |
@@ -25,6 +25,6 @@ |
||
25 | 25 | */ |
26 | 26 | public function errorMessage() |
27 | 27 | { |
28 | - return "Error: " . $this->getMessage(); |
|
28 | + return "Error: ".$this->getMessage(); |
|
29 | 29 | } |
30 | 30 | } |
31 | 31 | \ No newline at end of file |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | $sqlQuery = DatabaseQuery::selectAllQuery(self::getTableName($connection)); |
72 | 72 | $query = $connection->prepare($sqlQuery); |
73 | 73 | $query->execute(); |
74 | - if ( $query->rowCount() ) |
|
74 | + if ($query->rowCount()) |
|
75 | 75 | { |
76 | 76 | return new GetData($query->fetchAll($connection::FETCH_ASSOC)); |
77 | 77 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $sqlQuery = $databaseQuery->selectQuery(self::getTableName($connection), $data, $condition, $connection); |
93 | 93 | $query = $connection->prepare($sqlQuery); |
94 | 94 | $query->execute(); |
95 | - if ( $query->rowCount() ) |
|
95 | + if ($query->rowCount()) |
|
96 | 96 | { |
97 | 97 | return new GetData($query->fetchAll($connection::FETCH_ASSOC)); |
98 | 98 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $sqlQuery = DatabaseQuery::selectQuery(self::getTableName($connection), ['id' => $value], NULL, $connection); |
113 | 113 | $query = $connection->prepare($sqlQuery); |
114 | 114 | $query->execute(); |
115 | - if ( $query->rowCount() ) |
|
115 | + if ($query->rowCount()) |
|
116 | 116 | { |
117 | 117 | $found = new static; |
118 | 118 | $found->id = $value; |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | |
135 | 135 | $query = $this->insertQuery(self::getTableName($connection)); |
136 | 136 | $statement = $connection->prepare($query); |
137 | - if( $statement->execute() ) |
|
137 | + if ($statement->execute()) |
|
138 | 138 | { |
139 | 139 | return true; |
140 | 140 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | |
155 | 155 | $updateQuery = $this->updateQuery(self::getTableName($connection)); |
156 | 156 | $statement = $connection->prepare($updateQuery); |
157 | - if( $statement->execute() ) |
|
157 | + if ($statement->execute()) |
|
158 | 158 | { |
159 | 159 | return true; |
160 | 160 | } |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | { |
172 | 172 | $connection = DatabaseQuery::checkConnection($dbConnection); |
173 | 173 | |
174 | - $query = $connection->prepare('DELETE FROM ' . self::getTableName($connection) . ' WHERE id = '.$value); |
|
174 | + $query = $connection->prepare('DELETE FROM '.self::getTableName($connection).' WHERE id = '.$value); |
|
175 | 175 | $query->execute(); |
176 | 176 | $check = $query->rowCount(); |
177 | 177 | if ($check) |
@@ -25,6 +25,6 @@ |
||
25 | 25 | */ |
26 | 26 | public function errorMessage() |
27 | 27 | { |
28 | - return "Error: " . $this->getMessage(); |
|
28 | + return "Error: ".$this->getMessage(); |
|
29 | 29 | } |
30 | 30 | } |
31 | 31 | \ No newline at end of file |
@@ -25,6 +25,6 @@ |
||
25 | 25 | */ |
26 | 26 | public function errorMessage() |
27 | 27 | { |
28 | - return "Error: " . $this->getMessage(); |
|
28 | + return "Error: ".$this->getMessage(); |
|
29 | 29 | } |
30 | 30 | } |
31 | 31 | \ No newline at end of file |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | { |
48 | 48 | parent::__construct($this->mysqlConnectionString(), $this->user, $this->password); |
49 | 49 | } |
50 | - elseif($this->driver === 'sqlite') |
|
50 | + elseif ($this->driver === 'sqlite') |
|
51 | 51 | { |
52 | 52 | parent::__construct($this->sqlitConnectionString()); |
53 | 53 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | */ |
64 | 64 | protected function pgsqlConnectionString() |
65 | 65 | { |
66 | - return $this->driver . ':host=' . $this->host . ';port=' . $this->port . ';dbname=' . $this->dbname . ';user=' . $this->user . ';password=' . $this->password; |
|
66 | + return $this->driver.':host='.$this->host.';port='.$this->port.';dbname='.$this->dbname.';user='.$this->user.';password='.$this->password; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | protected function mysqlConnectionString() |
75 | 75 | { |
76 | - return $this->driver . ':host=' . $this->host . ';dbname=' . $this->dbname . ';charset=utf8mb4'; |
|
76 | + return $this->driver.':host='.$this->host.';dbname='.$this->dbname.';charset=utf8mb4'; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | /** |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | */ |
84 | 84 | protected function sqlitConnectionString() |
85 | 85 | { |
86 | - return $this->driver . ':' . $this->sqlitePath; |
|
86 | + return $this->driver.':'.$this->sqlitePath; |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | */ |
92 | 92 | protected function loadEnv() |
93 | 93 | { |
94 | - if( ! getenv("APP_ENV")) |
|
94 | + if ( ! getenv("APP_ENV")) |
|
95 | 95 | { |
96 | 96 | $dotenv = new Dotenv($_SERVER['DOCUMENT_ROOT']); |
97 | 97 | $dotenv->load(); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | |
24 | 24 | public function all() |
25 | 25 | { |
26 | - return json_decode( json_encode( $this->getAllData() ) ); |
|
26 | + return json_decode(json_encode($this->getAllData())); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function first() |
49 | 49 | { |
50 | - return json_decode( $this->toJson() ); |
|
50 | + return json_decode($this->toJson()); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |