Completed
Push — master ( 672085...644962 )
by Adeniyi
12s
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/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
     }
@@ -51,12 +51,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
src/Helper/Model.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      * getALL()
26 26
      * Get all record from the database
27 27
      *
28
-     * @return object
28
+     * @return GetData
29 29
      */
30 30
     public function getAll($dbConnection = NULL)
31 31
     {
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
      * where($data, $condition)
45 45
      * Get data from database where $data = $condition
46 46
      *
47
-     * @return object
47
+     * @return GetData
48 48
      */
49 49
     public function where($data, $condition = NULL, $dbConnection = NULL)
50 50
     {
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
      * find($value)
65 65
      * Find data from database where id = $value
66 66
      *
67
-     * @return array
67
+     * @return Model
68 68
      */
69 69
     public static function find($value, $dbConnection = NULL)
70 70
     {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 
95 95
         $query = $this->insertQuery(self::getTableName($connection));
96 96
         $statement = $connection->prepare($query);
97
-        if($statement->execute()) {
97
+        if ($statement->execute()) {
98 98
             return true;
99 99
         }
100 100
         throw new  DataAlreadyExistException();
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
     {
130 130
         $connection = DatabaseQuery::checkConnection($dbConnection);
131 131
 
132
-        $query = $connection->prepare('DELETE FROM ' . self::getTableName($connection) . ' WHERE id = '.$value);
132
+        $query = $connection->prepare('DELETE FROM '.self::getTableName($connection).' WHERE id = '.$value);
133 133
         $query->execute();
134 134
         $check = $query->rowCount();
135 135
         if ($check) {
Please login to merge, or discard this patch.
src/Helper/Relationships.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -41,6 +41,9 @@
 block discarded – undo
41 41
         return $output;
42 42
     }
43 43
 
44
+    /**
45
+     * @param string $con
46
+     */
44 47
     public function whereClause($data = null, $condition = null, $con = null)
45 48
     {
46 49
     	$joinClause = self::joinClause();
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -23,16 +23,16 @@  discard block
 block discarded – undo
23 23
         $output = "";
24 24
         $i = 0;
25 25
 
26
-        if (! isset($data[0]) || $data[1]->REFERENCED_TABLE_NAME !== null) {
27
-            foreach($data as $key => $value) {
26
+        if ( ! isset($data[0]) || $data[1]->REFERENCED_TABLE_NAME !== null) {
27
+            foreach ($data as $key => $value) {
28 28
                 if ( ! empty($value->REFERENCED_TABLE_NAME)) {
29 29
                     $output .= ' JOIN '.$value->REFERENCED_TABLE_NAME;
30 30
                 }
31 31
             }
32
-            foreach($data as $key => $value) {
32
+            foreach ($data as $key => $value) {
33 33
                 $i++;
34 34
                 $whereAnd = $i > 1 ? 'AND' : 'WHERE';
35
-                if ( empty($value->REFERENCED_TABLE_NAME)) {
35
+                if (empty($value->REFERENCED_TABLE_NAME)) {
36 36
                     $value->REFERENCED_TABLE_NAME = self::getTableName($connection);
37 37
                     $value->REFERENCED_COLUMN_NAME = $value->COLUMN_NAME;
38 38
                 }
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         } else if ($joinClause == false && $data !== null) {
59 59
             $query .= ' WHERE '.$columnName;
60 60
         } else {
61
-            $query .= ($data === null) ? $joinClause : $joinClause .' AND '.$columnName;
61
+            $query .= ($data === null) ? $joinClause : $joinClause.' AND '.$columnName;
62 62
         }
63 63
         return $query;
64 64
     }
Please login to merge, or discard this patch.