Completed
Push — master ( 62fed0...edf4b9 )
by Adeniyi
8s
created
src/Helper/Inflector.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -81,15 +81,15 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Interface/DatabaseQueryInterface.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,9 +11,9 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Exceptions/EmptyDatabaseException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,6 +25,6 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
src/Exceptions/ErrorInsertingException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,6 +25,6 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
src/Exceptions/DataAlreadyExistException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,6 +25,6 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
src/Exceptions/DataNotFoundException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,6 +25,6 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
src/Database/DBConfig.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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();
Please login to merge, or discard this patch.
src/Helper/Schema.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -25,13 +25,13 @@  discard block
 block discarded – undo
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
     }
@@ -49,12 +49,12 @@  discard block
 block discarded – undo
49 49
         $callback = function($fieldName) use (&$query)
50 50
         {
51 51
             $e = explode(" ", $fieldName);
52
-            if(count($e) == 2)
52
+            if (count($e) == 2)
53 53
             {
54
-                $query .= $this->$e[0]($e[1], 20) .", ".PHP_EOL;
55
-            }else
54
+                $query .= $this->$e[0]($e[1], 20).", ".PHP_EOL;
55
+            } else
56 56
             {
57
-                    $query .= $this->$e[0]($e[1], $e[2]) .", ".PHP_EOL;
57
+                    $query .= $this->$e[0]($e[1], $e[2]).", ".PHP_EOL;
58 58
             }
59 59
         };
60 60
         array_walk($this->fieldDescription, $callback);
@@ -87,11 +87,11 @@  discard block
 block discarded – undo
87 87
         {
88 88
             $sqlQuery = self::sanitizeQuery($tablename);
89 89
             $query = $connection->prepare($sqlQuery);
90
-            if($query->execute())
90
+            if ($query->execute())
91 91
             {
92 92
                 return true;
93 93
             }
94
-        }catch(PDOException $e){
94
+        } catch (PDOException $e) {
95 95
             return $e->getMessage();
96 96
         }
97 97
     }
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
      */
114 114
     public function strings($value, $length)
115 115
     {
116
-        return $value ." varchar (".$length.") NOT NULL";
116
+        return $value." varchar (".$length.") NOT NULL";
117 117
     }
118 118
 
119 119
     /**
@@ -198,6 +198,6 @@  discard block
 block discarded – undo
198 198
                     $apend = 'timestamp';
199 199
                 break;
200 200
         }
201
-        return $value . " " . $apend . " NOT NULL";
201
+        return $value." ".$apend." NOT NULL";
202 202
     }
203 203
 }
204 204
\ No newline at end of file
Please login to merge, or discard this patch.
src/Helper/Model.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      */
47 47
     public function tableName()
48 48
     {
49
-        if(isset($this->table)) {
49
+        if (isset($this->table)) {
50 50
             return $this->table;
51 51
         }
52 52
         return null;
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
         $sqlQuery = DatabaseQuery::selectAllQuery(self::getTableName($connection), self::fields());
106 106
         $query = $connection->prepare($sqlQuery);
107 107
         $query->execute();
108
-        if ( $query->rowCount() )
108
+        if ($query->rowCount())
109 109
         {
110 110
             return new GetData($query->fetchAll($connection::FETCH_ASSOC));
111 111
         }
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
         $sqlQuery = $databaseQuery->selectQuery(self::getTableName($connection), $data, $condition, $connection);
127 127
         $query = $connection->prepare($sqlQuery);
128 128
         $query->execute();
129
-        if ( $query->rowCount() )
129
+        if ($query->rowCount())
130 130
         {
131 131
             return new GetData($query->fetchAll($connection::FETCH_ASSOC));
132 132
         }
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
         $sqlQuery = DatabaseQuery::selectQuery(self::getTableName($connection), ['id' => $value], NULL, $connection);
147 147
         $query = $connection->prepare($sqlQuery);
148 148
         $query->execute();
149
-        if ( $query->rowCount() )
149
+        if ($query->rowCount())
150 150
         {
151 151
             $found = new static;
152 152
             $found->id = $value;
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 
169 169
         $query = $this->insertQuery(self::getTableName($connection));
170 170
         $statement = $connection->prepare($query);
171
-        if( $statement->execute() )
171
+        if ($statement->execute())
172 172
         {
173 173
             return true;
174 174
         }
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 
189 189
         $updateQuery = $this->updateQuery(self::getTableName($connection));
190 190
         $statement = $connection->prepare($updateQuery);
191
-        if( $statement->execute() )
191
+        if ($statement->execute())
192 192
         {
193 193
             return true;
194 194
         }
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
     {
206 206
         $connection = DatabaseQuery::checkConnection($dbConnection);
207 207
 
208
-        $query = $connection->prepare('DELETE FROM ' . self::getTableName($connection) . ' WHERE id = '.$value);
208
+        $query = $connection->prepare('DELETE FROM '.self::getTableName($connection).' WHERE id = '.$value);
209 209
         $query->execute();
210 210
         $check = $query->rowCount();
211 211
         if ($check)
Please login to merge, or discard this patch.