Completed
Pull Request — master (#21)
by Adeniyi
02:10
created
src/Interface/GetDataInterface.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Defining Interface for class GetData.
4
- *
5
- * @package Ibonly\PotatoORM\ModelInterface
6
- * @author  Ibraheem ADENIYI <[email protected]>
7
- * @license MIT <https://opensource.org/licenses/MIT>
8
- */
3
+     * Defining Interface for class GetData.
4
+     *
5
+     * @package Ibonly\PotatoORM\ModelInterface
6
+     * @author  Ibraheem ADENIYI <[email protected]>
7
+     * @license MIT <https://opensource.org/licenses/MIT>
8
+     */
9 9
 
10 10
 namespace Ibonly\PotatoORM;
11 11
 
Please login to merge, or discard this patch.
src/Interface/ModelInterface.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Defining Interface for class Model.
4
- *
5
- * @package Ibonly\PotatoORM\ModelInterface
6
- * @author  Ibraheem ADENIYI <[email protected]>
7
- * @license MIT <https://opensource.org/licenses/MIT>
8
- */
3
+     * Defining Interface for class Model.
4
+     *
5
+     * @package Ibonly\PotatoORM\ModelInterface
6
+     * @author  Ibraheem ADENIYI <[email protected]>
7
+     * @license MIT <https://opensource.org/licenses/MIT>
8
+     */
9 9
 
10 10
 namespace Ibonly\PotatoORM;
11 11
 
Please login to merge, or discard this patch.
src/Helper/Model.php 3 patches
Unused Use Statements   -5 removed lines patch added patch discarded remove patch
@@ -9,17 +9,12 @@
 block discarded – undo
9 9
 
10 10
 namespace Ibonly\PotatoORM;
11 11
 
12
-use PDO;
13
-use Exception;
14
-use PDOException;
15 12
 use Ibonly\PotatoORM\GetData;
16 13
 use Ibonly\PotatoORM\DatabaseQuery;
17 14
 use Ibonly\PotatoORM\ModelInterface;
18 15
 use Ibonly\PotatoORM\UserNotFoundException;
19 16
 use Ibonly\PotatoORM\EmptyDatabaseException;
20 17
 use Ibonly\PotatoORM\SaveUserExistException;
21
-use Ibonly\PotatoORM\ColumnNotExistExeption;
22
-use Ibonly\PotatoORM\InvalidConnectionException;
23 18
 
24 19
 class Model extends DatabaseQuery implements ModelInterface
25 20
 {
Please login to merge, or discard this patch.
Doc Comments   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -51,6 +51,7 @@  discard block
 block discarded – undo
51 51
     /**
52 52
      * getTableName()
53 53
      *
54
+     * @param string $connection
54 55
      * @return string
55 56
      */
56 57
     public static function getTableName($connection)
@@ -62,7 +63,7 @@  discard block
 block discarded – undo
62 63
      * getALL()
63 64
      * Get all record from the database
64 65
      *
65
-     * @return object
66
+     * @return GetData
66 67
      */
67 68
     public function getALL($dbConnection = NULL)
68 69
     {
@@ -82,7 +83,7 @@  discard block
 block discarded – undo
82 83
      * where($data, $condition)
83 84
      * Get data from database where $data = $condition
84 85
      *
85
-     * @return object
86
+     * @return GetData
86 87
      */
87 88
     public function where($data, $condition = NULL, $dbConnection = NULL)
88 89
     {
@@ -103,7 +104,7 @@  discard block
 block discarded – undo
103 104
      * find($value)
104 105
      * Find data from database where id = $value
105 106
      *
106
-     * @return array
107
+     * @return Model
107 108
      */
108 109
     public static function find($value, $dbConnection = NULL)
109 110
     {
Please login to merge, or discard this 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.
src/Interface/SchemaInterface.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Defining Interface for class SchemaInterface.
4
- *
5
- * @package Ibonly\PotatoORM\DatabaseQueryInterface
6
- * @author  Ibraheem ADENIYI <[email protected]>
7
- * @license MIT <https://opensource.org/licenses/MIT>
8
- */
3
+     * Defining Interface for class SchemaInterface.
4
+     *
5
+     * @package Ibonly\PotatoORM\DatabaseQueryInterface
6
+     * @author  Ibraheem ADENIYI <[email protected]>
7
+     * @license MIT <https://opensource.org/licenses/MIT>
8
+     */
9 9
 
10 10
 namespace Ibonly\PotatoORM;
11 11
 
Please login to merge, or discard this patch.
src/Exceptions/DataAlreadyExistException.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Exception for user already exist
4
- *
5
- * @package Ibonly\PotatoORM\DataAlreadyExistException
6
- * @author  Ibraheem ADENIYI <[email protected]>
7
- * @license MIT <https://opensource.org/licenses/MIT>
8
- */
3
+     * Exception for user already exist
4
+     *
5
+     * @package Ibonly\PotatoORM\DataAlreadyExistException
6
+     * @author  Ibraheem ADENIYI <[email protected]>
7
+     * @license MIT <https://opensource.org/licenses/MIT>
8
+     */
9 9
 
10 10
 namespace Ibonly\PotatoORM;
11 11
 
Please login to merge, or discard this 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 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Exception for user not found
4
- *
5
- * @package Ibonly\PotatoORM\DataNotFoundException
6
- * @author  Ibraheem ADENIYI <[email protected]>
7
- * @license MIT <https://opensource.org/licenses/MIT>
8
- */
3
+     * Exception for user not found
4
+     *
5
+     * @package Ibonly\PotatoORM\DataNotFoundException
6
+     * @author  Ibraheem ADENIYI <[email protected]>
7
+     * @license MIT <https://opensource.org/licenses/MIT>
8
+     */
9 9
 
10 10
 namespace Ibonly\PotatoORM;
11 11
 
Please login to merge, or discard this 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/Helper/GetData.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -53,8 +53,8 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
      */
63 63
     public function first()
64 64
     {
65
-        return json_decode( $this->toJson() );
65
+        return json_decode($this->toJson());
66 66
     }
67 67
 
68 68
     /**
Please login to merge, or discard this patch.