@@ -39,13 +39,13 @@ discard block |
||
| 39 | 39 | trait Inflector |
| 40 | 40 | { |
| 41 | 41 | /** |
| 42 | - * Pluralizes English nouns. |
|
| 43 | - * |
|
| 44 | - * @access public |
|
| 45 | - * @static |
|
| 46 | - * @param string $word English noun to pluralize |
|
| 47 | - * @return string Plural noun |
|
| 48 | - */ |
|
| 42 | + * Pluralizes English nouns. |
|
| 43 | + * |
|
| 44 | + * @access public |
|
| 45 | + * @static |
|
| 46 | + * @param string $word English noun to pluralize |
|
| 47 | + * @return string Plural noun |
|
| 48 | + */ |
|
| 49 | 49 | public static function pluralize($word) |
| 50 | 50 | { |
| 51 | 51 | $plural = array( |
@@ -102,13 +102,13 @@ discard block |
||
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | /** |
| 105 | - * Singularizes English nouns. |
|
| 106 | - * |
|
| 107 | - * @access public |
|
| 108 | - * @static |
|
| 109 | - * @param string $word English noun to singularize |
|
| 110 | - * @return string Singular noun. |
|
| 111 | - */ |
|
| 105 | + * Singularizes English nouns. |
|
| 106 | + * |
|
| 107 | + * @access public |
|
| 108 | + * @static |
|
| 109 | + * @param string $word English noun to singularize |
|
| 110 | + * @return string Singular noun. |
|
| 111 | + */ |
|
| 112 | 112 | public function singularize($word) |
| 113 | 113 | { |
| 114 | 114 | $singular = array ( |
@@ -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 | |
@@ -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 |
@@ -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(); |
@@ -53,8 +53,8 @@ |
||
| 53 | 53 | /** |
| 54 | 54 | * Get the count of the fetch element |
| 55 | 55 | */ |
| 56 | - public function getCount() |
|
| 57 | - { |
|
| 56 | + public function getCount() |
|
| 57 | + { |
|
| 58 | 58 | return sizeof($this->value); |
| 59 | - } |
|
| 59 | + } |
|
| 60 | 60 | } |
| 61 | 61 | \ No newline at end of file |
@@ -25,13 +25,13 @@ discard block |
||
| 25 | 25 | * |
| 26 | 26 | * @return array |
| 27 | 27 | */ |
| 28 | - public function field($type, $fieldName, $length=NULL) |
|
| 28 | + public function field($type, $fieldName, $length = NULL) |
|
| 29 | 29 | { |
| 30 | - if($length === null){ |
|
| 31 | - $this->fieldDescription[] = $type ." ".$fieldName; |
|
| 32 | - }else |
|
| 30 | + if ($length === null) { |
|
| 31 | + $this->fieldDescription[] = $type." ".$fieldName; |
|
| 32 | + } else |
|
| 33 | 33 | { |
| 34 | - $this->fieldDescription[] = $type ." ".$fieldName." ".$length; |
|
| 34 | + $this->fieldDescription[] = $type." ".$fieldName." ".$length; |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | } |
@@ -51,12 +51,12 @@ discard block |
||
| 51 | 51 | $fields = explode(" ", $fieldName); |
| 52 | 52 | |
| 53 | 53 | $constrain = $fields[0]; |
| 54 | - if(count($fields) == 2) |
|
| 54 | + if (count($fields) == 2) |
|
| 55 | 55 | { |
| 56 | - $query .= $this->$constrain($fields[1], 20) .", ".PHP_EOL; |
|
| 57 | - }else |
|
| 56 | + $query .= $this->$constrain($fields[1], 20).", ".PHP_EOL; |
|
| 57 | + } else |
|
| 58 | 58 | { |
| 59 | - $query .= $this->$constrain($fields[1], $fields[2]) .", ".PHP_EOL; |
|
| 59 | + $query .= $this->$constrain($fields[1], $fields[2]).", ".PHP_EOL; |
|
| 60 | 60 | } |
| 61 | 61 | }; |
| 62 | 62 | array_walk($this->fieldDescription, $callback); |
@@ -90,11 +90,11 @@ discard block |
||
| 90 | 90 | { |
| 91 | 91 | $sqlQuery = self::sanitizeQuery($tablename); |
| 92 | 92 | $query = $connection->prepare($sqlQuery); |
| 93 | - if($query->execute()) |
|
| 93 | + if ($query->execute()) |
|
| 94 | 94 | { |
| 95 | 95 | return true; |
| 96 | 96 | } |
| 97 | - }catch(PDOException $e){ |
|
| 97 | + } catch (PDOException $e) { |
|
| 98 | 98 | return $e->getMessage(); |
| 99 | 99 | } |
| 100 | 100 | } |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | public function strings($value, $length) |
| 118 | 118 | { |
| 119 | - return $value ." varchar (".$length.") NOT NULL"; |
|
| 119 | + return $value." varchar (".$length.") NOT NULL"; |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
@@ -202,6 +202,6 @@ discard block |
||
| 202 | 202 | $apend = 'timestamp'; |
| 203 | 203 | break; |
| 204 | 204 | } |
| 205 | - return $value . " " . $apend . " NOT NULL"; |
|
| 205 | + return $value." ".$apend." NOT NULL"; |
|
| 206 | 206 | } |
| 207 | 207 | } |
| 208 | 208 | \ No newline at end of file |
@@ -28,10 +28,10 @@ |
||
| 28 | 28 | public function field($type, $fieldName, $length=NULL) |
| 29 | 29 | { |
| 30 | 30 | if($length === null){ |
| 31 | - $this->fieldDescription[] = $type ." ".$fieldName; |
|
| 31 | + $this->fieldDescription[] = $type ." ".$fieldName; |
|
| 32 | 32 | }else |
| 33 | 33 | { |
| 34 | - $this->fieldDescription[] = $type ." ".$fieldName." ".$length; |
|
| 34 | + $this->fieldDescription[] = $type ." ".$fieldName." ".$length; |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | interface GetDataInterface |
| 13 | 13 | { |
| 14 | - public function all(); |
|
| 14 | + public function all(); |
|
| 15 | 15 | |
| 16 | 16 | public function allDESC($limit); |
| 17 | 17 | |
@@ -23,5 +23,5 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | public function first(); |
| 25 | 25 | |
| 26 | - public function getCount(); |
|
| 26 | + public function getCount(); |
|
| 27 | 27 | } |