@@ -2,17 +2,8 @@ |
||
| 2 | 2 | |
| 3 | 3 | require_once 'vendor/autoload.php'; |
| 4 | 4 | |
| 5 | -use Sirolad\Potato; |
|
| 6 | -use Sirolad\DB\DBConnect; |
|
| 7 | -use Sirolad\Entities\Car; |
|
| 8 | 5 | use Sirolad\Entities\User; |
| 9 | -use Sirolad\Entities\Motor; |
|
| 10 | -use Sirolad\Entities\Bicycle; |
|
| 11 | -use Sirolad\Libraries\Formatter; |
|
| 12 | -use Sirolad\Libraries\TableMapper; |
|
| 13 | -use Sirolad\Exceptions\EmptyTableException; |
|
| 14 | 6 | use Sirolad\Exceptions\RecordNotFoundException; |
| 15 | -use Sirolad\Exceptions\TableDoesNotExistException; |
|
| 16 | 7 | |
| 17 | 8 | #User Operations |
| 18 | 9 | //insert |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | /** |
| 59 | 59 | * Generate unnamed placeholders depending on the number of table fields concerned |
| 60 | 60 | * |
| 61 | - * @param array $record Set of affected table fields |
|
| 61 | + * @param array $records Set of affected table fields |
|
| 62 | 62 | * @return array $placeholder Sql statement placeholders for field values |
| 63 | 63 | */ |
| 64 | 64 | public static function generateUnnamedPlaceholders(array $records) |
@@ -7,7 +7,6 @@ |
||
| 7 | 7 | * */ |
| 8 | 8 | namespace Sirolad\Libraries; |
| 9 | 9 | |
| 10 | -use Sirolad\Exception; |
|
| 11 | 10 | use Sirolad\Interfaces\FormatterInterface; |
| 12 | 11 | |
| 13 | 12 | /** |
@@ -1,10 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @package A simple ORM that performs basic CRUD operations |
|
| 4 | - * @author Surajudeen AKANDE <[email protected]> |
|
| 5 | - * @license MIT <https://opensource.org/licenses/MIT> |
|
| 6 | - * @link http://www.github.com/andela-sakande |
|
| 7 | - * */ |
|
| 3 | + * @package A simple ORM that performs basic CRUD operations |
|
| 4 | + * @author Surajudeen AKANDE <[email protected]> |
|
| 5 | + * @license MIT <https://opensource.org/licenses/MIT> |
|
| 6 | + * @link http://www.github.com/andela-sakande |
|
| 7 | + * */ |
|
| 8 | 8 | namespace Sirolad\Libraries; |
| 9 | 9 | |
| 10 | 10 | use Sirolad\Exception; |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | |
| 50 | 50 | while ($token) { |
| 51 | 51 | $token = strtok($delimiter); |
| 52 | - $output .= ',' .$token; |
|
| 52 | + $output .= ',' . $token; |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | return rtrim($output, ','); |
@@ -23,7 +23,6 @@ discard block |
||
| 23 | 23 | * Check for the existence of a table in the currentt database |
| 24 | 24 | * |
| 25 | 25 | * @param string $table Name of table to be searched in the database |
| 26 | - * @param DbConnnect $dbConnect Database connection object |
|
| 27 | 26 | * @return string Name of the table checked |
| 28 | 27 | */ |
| 29 | 28 | public static function checkTableName($table) |
@@ -44,6 +43,7 @@ discard block |
||
| 44 | 43 | |
| 45 | 44 | /** |
| 46 | 45 | * @var array classname from class namespace |
| 46 | + * @param string $className |
|
| 47 | 47 | * @return string which is in lower case |
| 48 | 48 | **/ |
| 49 | 49 | public static function getClassName($className) |
@@ -12,7 +12,6 @@ |
||
| 12 | 12 | use Sirolad\DB\DBConnect; |
| 13 | 13 | use Sirolad\Libraries\Formatter; |
| 14 | 14 | use Sirolad\Interfaces\TableMapperInterface; |
| 15 | -use Sirolad\Exceptions\TableDoesNotExistException; |
|
| 16 | 15 | |
| 17 | 16 | /** |
| 18 | 17 | * |
@@ -36,8 +36,7 @@ |
||
| 36 | 36 | } |
| 37 | 37 | } catch (PDOException $e) { |
| 38 | 38 | return $e->getMessage(); |
| 39 | - } |
|
| 40 | - finally { |
|
| 39 | + } finally { |
|
| 41 | 40 | $dbConnect = null; |
| 42 | 41 | } |
| 43 | 42 | } |
@@ -112,8 +112,8 @@ |
||
| 112 | 112 | |
| 113 | 113 | /** |
| 114 | 114 | * Get all the records in a database table |
| 115 | - * @return array|object |
|
| 116 | - * @return exception |
|
| 115 | + * @return string |
|
| 116 | + * @return string |
|
| 117 | 117 | */ |
| 118 | 118 | public function getAll() |
| 119 | 119 | { |
@@ -18,7 +18,6 @@ |
||
| 18 | 18 | use Sirolad\Interfaces\PotatoInterface; |
| 19 | 19 | use Sirolad\Exceptions\EmptyTableException; |
| 20 | 20 | use Sirolad\Exceptions\RecordNotFoundException; |
| 21 | -use Sirolad\Exceptions\TableDoesNotExistException; |
|
| 22 | 21 | |
| 23 | 22 | /** |
| 24 | 23 | * Potato is the main class which is not to be instantiated. |
@@ -104,8 +104,7 @@ discard block |
||
| 104 | 104 | } |
| 105 | 105 | } catch (RecordNotFoundException $e) { |
| 106 | 106 | return $e->message(); |
| 107 | - } |
|
| 108 | - finally { |
|
| 107 | + } finally { |
|
| 109 | 108 | $dbConnect = null; |
| 110 | 109 | } |
| 111 | 110 | } |
@@ -129,8 +128,7 @@ discard block |
||
| 129 | 128 | } |
| 130 | 129 | } catch (PDOException $e) { |
| 131 | 130 | return $e->getMessage(); |
| 132 | - } |
|
| 133 | - finally { |
|
| 131 | + } finally { |
|
| 134 | 132 | $dbConn = null; |
| 135 | 133 | } |
| 136 | 134 | } |
@@ -158,8 +156,7 @@ discard block |
||
| 158 | 156 | return $e->getMessage(); |
| 159 | 157 | } catch (RecordNotFoundException $e) { |
| 160 | 158 | return $e->message(); |
| 161 | - } |
|
| 162 | - finally { |
|
| 159 | + } finally { |
|
| 163 | 160 | $dbConn = null; |
| 164 | 161 | } |
| 165 | 162 | |
@@ -186,8 +183,7 @@ discard block |
||
| 186 | 183 | } |
| 187 | 184 | } catch (PDOException $e) { |
| 188 | 185 | echo $e->getMessage(); |
| 189 | - } |
|
| 190 | - finally { |
|
| 186 | + } finally { |
|
| 191 | 187 | $dbConn = null; |
| 192 | 188 | } |
| 193 | 189 | } |
@@ -86,7 +86,7 @@ |
||
| 86 | 86 | */ |
| 87 | 87 | public function loadDotenv() |
| 88 | 88 | { |
| 89 | - $dotEnv = new Dotenv(__DIR__.'/../..'); |
|
| 89 | + $dotEnv = new Dotenv(__DIR__ . '/../..'); |
|
| 90 | 90 | $dotEnv->load(); |
| 91 | 91 | } |
| 92 | 92 | } |
@@ -16,9 +16,9 @@ |
||
| 16 | 16 | * */ |
| 17 | 17 | class EmptyTableException extends PDOException |
| 18 | 18 | { |
| 19 | - /** |
|
| 20 | - * constructor class |
|
| 21 | - * */ |
|
| 19 | + /** |
|
| 20 | + * constructor class |
|
| 21 | + * */ |
|
| 22 | 22 | public function __construct() |
| 23 | 23 | { |
| 24 | 24 | parent::__construct('The table is empty.'); |
@@ -15,9 +15,9 @@ |
||
| 15 | 15 | |
| 16 | 16 | class RecordNotFoundException extends PDOException |
| 17 | 17 | { |
| 18 | - /** |
|
| 19 | - * constructor class |
|
| 20 | - * */ |
|
| 18 | + /** |
|
| 19 | + * constructor class |
|
| 20 | + * */ |
|
| 21 | 21 | public function __construct() |
| 22 | 22 | { |
| 23 | 23 | $this->message(); |
@@ -1,10 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @package A simple ORM that performs basic CRUD operations |
|
| 4 | - * @author Surajudeen AKANDE <[email protected]> |
|
| 5 | - * @license MIT <https://opensource.org/licenses/MIT> |
|
| 6 | - * @link http://www.github.com/andela-sakande |
|
| 7 | - * */ |
|
| 3 | + * @package A simple ORM that performs basic CRUD operations |
|
| 4 | + * @author Surajudeen AKANDE <[email protected]> |
|
| 5 | + * @license MIT <https://opensource.org/licenses/MIT> |
|
| 6 | + * @link http://www.github.com/andela-sakande |
|
| 7 | + * */ |
|
| 8 | 8 | namespace Sirolad\Exceptions; |
| 9 | 9 | |
| 10 | 10 | use PDOException; |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * Test that the exact tablename is returned |
| 27 | - **/ |
|
| 27 | + **/ |
|
| 28 | 28 | public function testTableName() |
| 29 | 29 | { |
| 30 | 30 | $potato = new Potato(); |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | 35 | * Test delete from database |
| 36 | - **/ |
|
| 36 | + **/ |
|
| 37 | 37 | public function testDestroy() |
| 38 | 38 | { |
| 39 | 39 | $mock = Mockery::mock('Sirolad\Test\PotatoStub'); |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | 44 | * Test find from database |
| 45 | - **/ |
|
| 45 | + **/ |
|
| 46 | 46 | public function testFind() |
| 47 | 47 | { |
| 48 | 48 | $mock = Mockery::mock('Sirolad\Test\PotatoStub'); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | 53 | * Test that instantiated class are without attributes |
| 54 | - **/ |
|
| 54 | + **/ |
|
| 55 | 55 | public function testNewInstanceCreatesInstanceWithoutAttributes() |
| 56 | 56 | { |
| 57 | 57 | $instance = new PotatoStub(); |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | /** |
| 65 | 65 | * Test class can be instantiated |
| 66 | - **/ |
|
| 66 | + **/ |
|
| 67 | 67 | public function save() |
| 68 | 68 | { |
| 69 | 69 | $mock = Mockery::mock('Sirolad\Test\PotatoStub'); |