@@ -74,14 +74,14 @@ |
||
| 74 | 74 | 'sex' => 'sexes', |
| 75 | 75 | 'move' => 'moves'); |
| 76 | 76 | $lowercased_word = strtolower($word); |
| 77 | - foreach ($uncountable as $_uncountable){ |
|
| 78 | - if(substr($lowercased_word,(-1*strlen($_uncountable))) == $_uncountable){ |
|
| 77 | + foreach ($uncountable as $_uncountable) { |
|
| 78 | + if (substr($lowercased_word, (-1*strlen($_uncountable))) == $_uncountable) { |
|
| 79 | 79 | return $word; |
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | - foreach ($irregular as $_plural=> $_singular){ |
|
| 82 | + foreach ($irregular as $_plural=> $_singular) { |
|
| 83 | 83 | if (preg_match('/('.$_plural.')$/i', $word, $arr)) { |
| 84 | - return preg_replace('/('.$_plural.')$/i', substr($arr[0],0,1).substr($_singular,1), $word); |
|
| 84 | + return preg_replace('/('.$_plural.')$/i', substr($arr[0], 0, 1).substr($_singular, 1), $word); |
|
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | foreach ($plural as $rule => $replacement) { |
@@ -24,11 +24,11 @@ discard block |
||
| 24 | 24 | { |
| 25 | 25 | $this->loadEnv(); // load the environment variables |
| 26 | 26 | |
| 27 | - $this->databaseName = getenv('databaseName'); |
|
| 28 | - $this->databaseHost = getenv('databaseHost'); |
|
| 29 | - $this->databaseDriver = getenv('databaseDriver'); |
|
| 30 | - $this->databaseUsername = getenv('databaseUsername'); |
|
| 31 | - $this->databasePassword = getenv('databasePassword'); |
|
| 27 | + $this->databaseName = getenv('databaseName'); |
|
| 28 | + $this->databaseHost = getenv('databaseHost'); |
|
| 29 | + $this->databaseDriver = getenv('databaseDriver'); |
|
| 30 | + $this->databaseUsername = getenv('databaseUsername'); |
|
| 31 | + $this->databasePassword = getenv('databasePassword'); |
|
| 32 | 32 | |
| 33 | 33 | try { |
| 34 | 34 | $options = [ |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | parent::__construct($this->getDatabaseDriver(), $this->databaseUsername, $this->databasePassword, $options); |
| 40 | 40 | |
| 41 | - } catch(PDOException $e) { |
|
| 41 | + } catch (PDOException $e) { |
|
| 42 | 42 | return $e->getMessage(); |
| 43 | 43 | |
| 44 | 44 | } |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | public function loadEnv() |
| 80 | 80 | { |
| 81 | - if (! getenv("APP_ENV")) { |
|
| 81 | + if (!getenv("APP_ENV")) { |
|
| 82 | 82 | $dotenv = new Dotenv(__DIR__.'/../../'); |
| 83 | 83 | $dotenv->load(); |
| 84 | 84 | } |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | $sql = 'CREATE TABLE IF NOT EXISTS '.$tableName.'('; |
| 38 | - $sql.= ' id INT( 11 ) AUTO_INCREMENT PRIMARY KEY, name VARCHAR( 100 ), gender VARCHAR( 10 ), alias VARCHAR( 150 ) NOT NULL, class VARCHAR( 150 ), stack VARCHAR( 50 ) )'; |
|
| 38 | + $sql .= ' id INT( 11 ) AUTO_INCREMENT PRIMARY KEY, name VARCHAR( 100 ), gender VARCHAR( 10 ), alias VARCHAR( 150 ) NOT NULL, class VARCHAR( 150 ), stack VARCHAR( 50 ) )'; |
|
| 39 | 39 | |
| 40 | 40 | return $conn->exec($sql); |
| 41 | 41 | |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | * @license <https://opensource.org/license/MIT> MIT |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -namespace Laztopaz\potatoORM ; |
|
| 9 | +namespace Laztopaz\potatoORM; |
|
| 10 | 10 | |
| 11 | 11 | use Exception; |
| 12 | 12 | |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $unexpectedFields = self::checkIfMagicSetterContainsIsSameAsClassModel($tableFields, $associative1DArray); |
| 52 | 52 | |
| 53 | 53 | if (count($unexpectedFields) > 0) { |
| 54 | - throw TableFieldUndefinedException::reportUnknownTableField($unexpectedFields,"needs to be created as a table field"); |
|
| 54 | + throw TableFieldUndefinedException::reportUnknownTableField($unexpectedFields, "needs to be created as a table field"); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | unset($associative1DArray[0]); |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | { |
| 77 | 77 | $insertQuery = 'INSERT INTO '.$tableName; |
| 78 | 78 | |
| 79 | - $TableValues = implode(',',array_keys($associative1DArray)); |
|
| 79 | + $TableValues = implode(',', array_keys($associative1DArray)); |
|
| 80 | 80 | |
| 81 | 81 | foreach ($associative1DArray as $field => $value) { |
| 82 | 82 | $FormValues[] = "'".trim(addslashes($value))."'"; |
@@ -84,8 +84,8 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | $splittedTableValues = implode(',', $FormValues); |
| 86 | 86 | |
| 87 | - $insertQuery.= ' ('.$TableValues.')'; |
|
| 88 | - $insertQuery.= ' VALUES ('.$splittedTableValues.')'; |
|
| 87 | + $insertQuery .= ' ('.$TableValues.')'; |
|
| 88 | + $insertQuery .= ' VALUES ('.$splittedTableValues.')'; |
|
| 89 | 89 | |
| 90 | 90 | $executeQuery = $dbConn->exec($insertQuery); |
| 91 | 91 | |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | $unexpectedFields = []; |
| 217 | 217 | |
| 218 | 218 | foreach ($userSetterArray as $key => $val) { |
| 219 | - if (!in_array($key,$tableColumn)) { |
|
| 219 | + if (!in_array($key, $tableColumn)) { |
|
| 220 | 220 | $unexpectedFields[] = $key; |
| 221 | 221 | } |
| 222 | 222 | } |
@@ -232,11 +232,11 @@ discard block |
||
| 232 | 232 | */ |
| 233 | 233 | public function prepareUpdateQuery($sql) |
| 234 | 234 | { |
| 235 | - $splittedQuery = explode(",",$sql); |
|
| 235 | + $splittedQuery = explode(",", $sql); |
|
| 236 | 236 | |
| 237 | 237 | array_pop($splittedQuery); |
| 238 | 238 | |
| 239 | - $mergeData = implode(",",$splittedQuery); |
|
| 239 | + $mergeData = implode(",", $splittedQuery); |
|
| 240 | 240 | |
| 241 | 241 | return $mergeData; |
| 242 | 242 | |