@@ -4,11 +4,11 @@ |
||
| 4 | 4 | |
| 5 | 5 | class DatabaseConnectionStringFactoryTest extends PHPUnit_Framework_TestCase |
| 6 | 6 | { |
| 7 | - /** |
|
| 8 | - * The instance of DatabaseConnectionStringFactory used in the test. |
|
| 9 | - * |
|
| 10 | - * @var Pyjac\ORM\DatabaseConnectionStringFactory |
|
| 11 | - */ |
|
| 7 | + /** |
|
| 8 | + * The instance of DatabaseConnectionStringFactory used in the test. |
|
| 9 | + * |
|
| 10 | + * @var Pyjac\ORM\DatabaseConnectionStringFactory |
|
| 11 | + */ |
|
| 12 | 12 | protected $openSourceEvangelistFactory; |
| 13 | 13 | |
| 14 | 14 | /** |
@@ -10,15 +10,15 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | 12 | * Store instance of database connection used. |
| 13 | - * @var [type] |
|
| 14 | - */ |
|
| 13 | + * @var [type] |
|
| 14 | + */ |
|
| 15 | 15 | protected $databaseConnection; |
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | 18 | * Create a model instance. |
| 19 | 19 | * |
| 20 | 20 | */ |
| 21 | - public function __construct() |
|
| 21 | + public function __construct() |
|
| 22 | 22 | { |
| 23 | 23 | $this->databaseConnection = DatabaseConnection::getInstance()->databaseConnection; |
| 24 | 24 | |
@@ -26,19 +26,19 @@ discard block |
||
| 26 | 26 | /** |
| 27 | 27 | * Sets into $properties the $key => $value pairs |
| 28 | 28 | * |
| 29 | - * @param string $key |
|
| 30 | - * @param string $val |
|
| 31 | - * |
|
| 32 | - */ |
|
| 29 | + * @param string $key |
|
| 30 | + * @param string $val |
|
| 31 | + * |
|
| 32 | + */ |
|
| 33 | 33 | public function __set($key, $val) |
| 34 | 34 | { |
| 35 | 35 | $this->properties[$key] = $val; |
| 36 | 36 | } |
| 37 | 37 | /** |
| 38 | - * @param string $key |
|
| 39 | - * |
|
| 40 | - * @return array |
|
| 41 | - */ |
|
| 38 | + * @param string $key |
|
| 39 | + * |
|
| 40 | + * @return array |
|
| 41 | + */ |
|
| 42 | 42 | public function __get($key) |
| 43 | 43 | { |
| 44 | 44 | return $this->properties[$key]; |
@@ -48,15 +48,15 @@ discard block |
||
| 48 | 48 | * |
| 49 | 49 | * @return array |
| 50 | 50 | */ |
| 51 | - public function getProperties() |
|
| 52 | - { |
|
| 53 | - return $this->properties; |
|
| 54 | - } |
|
| 51 | + public function getProperties() |
|
| 52 | + { |
|
| 53 | + return $this->properties; |
|
| 54 | + } |
|
| 55 | 55 | /** |
| 56 | - * Gets the name of the child class with a 's'. |
|
| 57 | - * |
|
| 58 | - * @return string |
|
| 59 | - */ |
|
| 56 | + * Gets the name of the child class with a 's'. |
|
| 57 | + * |
|
| 58 | + * @return string |
|
| 59 | + */ |
|
| 60 | 60 | public function getTableName() |
| 61 | 61 | { |
| 62 | 62 | $className = explode('\\', get_called_class()); |
@@ -64,12 +64,12 @@ discard block |
||
| 64 | 64 | return $table; |
| 65 | 65 | } |
| 66 | 66 | /** |
| 67 | - * Find the particular model with the passed id. |
|
| 68 | - * |
|
| 69 | - * @param int $id |
|
| 70 | - * |
|
| 71 | - * @return object |
|
| 72 | - */ |
|
| 67 | + * Find the particular model with the passed id. |
|
| 68 | + * |
|
| 69 | + * @param int $id |
|
| 70 | + * |
|
| 71 | + * @return object |
|
| 72 | + */ |
|
| 73 | 73 | public static function find($id) |
| 74 | 74 | { |
| 75 | 75 | $model = new static; |
@@ -77,12 +77,12 @@ discard block |
||
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | /** |
| 80 | - * Get the particular model with the passed id. |
|
| 81 | - * |
|
| 82 | - * @param int $id |
|
| 83 | - * |
|
| 84 | - * @return object |
|
| 85 | - */ |
|
| 80 | + * Get the particular model with the passed id. |
|
| 81 | + * |
|
| 82 | + * @param int $id |
|
| 83 | + * |
|
| 84 | + * @return object |
|
| 85 | + */ |
|
| 86 | 86 | public function get($id) |
| 87 | 87 | { |
| 88 | 88 | $sql = "SELECT * FROM {$this->getTableName()} WHERE id={$id}"; |
@@ -96,10 +96,10 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
| 99 | - * Get all the models from the database. |
|
| 100 | - * |
|
| 101 | - * @return array |
|
| 102 | - */ |
|
| 99 | + * Get all the models from the database. |
|
| 100 | + * |
|
| 101 | + * @return array |
|
| 102 | + */ |
|
| 103 | 103 | public static function getAll() |
| 104 | 104 | { |
| 105 | 105 | $model = new static; |
@@ -107,10 +107,10 @@ discard block |
||
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | /** |
| 110 | - * Returns all the models from the database. |
|
| 111 | - * |
|
| 112 | - * @return array |
|
| 113 | - */ |
|
| 110 | + * Returns all the models from the database. |
|
| 111 | + * |
|
| 112 | + * @return array |
|
| 113 | + */ |
|
| 114 | 114 | public function all() |
| 115 | 115 | { |
| 116 | 116 | $sql = "SELECT * FROM {$this->getTableName()}"; |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | * Update the model in the database. |
| 125 | 125 | * |
| 126 | 126 | * @return int |
| 127 | - */ |
|
| 127 | + */ |
|
| 128 | 128 | private function update() |
| 129 | 129 | { |
| 130 | 130 | |
@@ -147,10 +147,10 @@ discard block |
||
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /** |
| 150 | - * Insert the model values into the database. |
|
| 151 | - * |
|
| 152 | - * @return int |
|
| 153 | - */ |
|
| 150 | + * Insert the model values into the database. |
|
| 151 | + * |
|
| 152 | + * @return int |
|
| 153 | + */ |
|
| 154 | 154 | private function create() |
| 155 | 155 | { |
| 156 | 156 | |
@@ -185,11 +185,11 @@ discard block |
||
| 185 | 185 | return $this->id ? $this->update() : $this->create(); |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | - /** |
|
| 189 | - * Delete a model from the database. |
|
| 190 | - * @param int $id |
|
| 191 | - * @return boolean |
|
| 192 | - */ |
|
| 188 | + /** |
|
| 189 | + * Delete a model from the database. |
|
| 190 | + * @param int $id |
|
| 191 | + * @return boolean |
|
| 192 | + */ |
|
| 193 | 193 | public static function destroy($id) |
| 194 | 194 | { |
| 195 | 195 | $model = new static; |