| @@ -101,7 +101,7 @@ | ||
| 101 | 101 | 'adaptar = sqlite', | 
| 102 | 102 | ]; | 
| 103 | 103 |          foreach ($configData as $cfg) { | 
| 104 | - fwrite($file, $cfg."\n"); | |
| 104 | + fwrite($file, $cfg . "\n"); | |
| 105 | 105 | } | 
| 106 | 106 | fclose($file); | 
| 107 | 107 | $result = $this->connector->getConfigurations($this->configFile); | 
| @@ -6,6 +6,9 @@ | ||
| 6 | 6 |  { | 
| 7 | 7 | public $message; | 
| 8 | 8 | |
| 9 | + /** | |
| 10 | + * @param string $message | |
| 11 | + */ | |
| 9 | 12 | public function __construct($message) | 
| 10 | 13 |      { | 
| 11 | 14 | $this->message = $message; | 
| @@ -50,10 +50,6 @@ discard block | ||
| 50 | 50 | * [connect Try setting up the connection wtith given connection parameters]. | 
| 51 | 51 | * | 
| 52 | 52 | * @param [string] $adaptar [The adapter to be used witht he connection to the database] | 
| 53 | - * @param [string] $host [The host name for the connection] | |
| 54 | - * @param [string] $dbname [The name of the database] | |
| 55 | - * @param [string] $username [The username to be used if it is required] | |
| 56 | - * @param [string] $password [The [assword to be used for the connectionif required.]] | |
| 57 | 53 | * | 
| 58 | 54 | * @return [type] [A PDO connection to the databsase] | 
| 59 | 55 | */ | 
| @@ -74,10 +70,6 @@ discard block | ||
| 74 | 70 | * Throw an InvalidAdaptarException if the given driver is invalid, does not exist or is not compatible with PDO. | 
| 75 | 71 | * | 
| 76 | 72 | * @param [string] $adaptar [The adaptar/driver name used to create PDO connection.] | 
| 77 | - * @param [string] $host [The hostname to be used for the PDO connection if mysql is chosen.] | |
| 78 | - * @param [string] $dbname [The name of the database of the PDO connection.] | |
| 79 | - * @param [string] $username [The username to be used for the PDO connection if mysql is chosen.] | |
| 80 | - * @param [string] $password [The password to be used for the PDO connection id mysql is chosen.] | |
| 81 | 73 | * | 
| 82 | 74 | * @return [type] [description] | 
| 83 | 75 | */ | 
| @@ -124,7 +116,7 @@ discard block | ||
| 124 | 116 | * [sqliteConnect Create an SQLite connection if the selected PDO drver is sqlite.]. | 
| 125 | 117 | * | 
| 126 | 118 | * @param [string] $adaptar The sqlite driver name | 
| 127 | - * @param [type] $dbFile [The database file. If this is null, then get the database file using the getSqliteFile method.] | |
| 119 | + * @param string $dbFile [The database file. If this is null, then get the database file using the getSqliteFile method.] | |
| 128 | 120 | * | 
| 129 | 121 | * @return [type] A PDO connection done with am sqlite driver. | 
| 130 | 122 | */ | 
| @@ -139,7 +131,6 @@ discard block | ||
| 139 | 131 | /** | 
| 140 | 132 | * [getSqliteFile Get the file location of the slqlite file if it is preferred to use an sqlite pdo connection.]. | 
| 141 | 133 | * | 
| 142 | - * @param [type] $path [The path to the sqlite database file.] | |
| 143 | 134 | * | 
| 144 | 135 | * @return [type] [The path to the sqlite file if provided or a default file path if the path in the provided argument is null.] | 
| 145 | 136 | */ | 
| @@ -153,7 +144,7 @@ discard block | ||
| 153 | 144 | /** | 
| 154 | 145 | * [getConfigurations Get the configuration data from the file path]. | 
| 155 | 146 | * | 
| 156 | - * @param [type] $filepath [The file path where the connection configuration information are located.] | |
| 147 | + * @param string $filepath [The file path where the connection configuration information are located.] | |
| 157 | 148 | * | 
| 158 | 149 | * @return [array] [An array of the configuration information after parsing the information.] | 
| 159 | 150 | */ | 
| @@ -167,6 +158,7 @@ discard block | ||
| 167 | 158 | /** | 
| 168 | 159 | * [getConfigFilePath Get the file path of the file where the configuration lies.]. | 
| 169 | 160 | * | 
| 161 | + * @param string $path | |
| 170 | 162 | * @return [string] [The file path of the location where the confuiguration information lie.] | 
| 171 | 163 | */ | 
| 172 | 164 | public function getConfigFilePath($path = null) | 
| @@ -227,7 +219,7 @@ discard block | ||
| 227 | 219 | /** | 
| 228 | 220 | * [throwFaultyConnectionException Throw an exception if along the lime the connection is not setup correctly]. | 
| 229 | 221 | * | 
| 230 | - * @param [string] $message [The message to be related in event of this exception.] | |
| 222 | + * @param string $message [The message to be related in event of this exception.] | |
| 231 | 223 | * | 
| 232 | 224 | * @return [type] [An inherited PDO exception with a customized message.] | 
| 233 | 225 | */ | 
| @@ -171,7 +171,7 @@ | ||
| 171 | 171 | */ | 
| 172 | 172 | public function getConfigFilePath($path = null) | 
| 173 | 173 |      { | 
| 174 | - return $path == null ? __DIR__.'/../config.ini' : $path; | |
| 174 | + return $path == null ? __DIR__ . '/../config.ini' : $path; | |
| 175 | 175 | } | 
| 176 | 176 | |
| 177 | 177 | /** | 
| @@ -85,8 +85,8 @@ discard block | ||
| 85 | 85 | /** | 
| 86 | 86 | * [find Find on record or row in the table given by an ID. | 
| 87 | 87 | * | 
| 88 | - * @param [type] $id [the ID of the row record to be fetched.] | |
| 89 | - * @param [type] $query [The query to be used for the database communication.] | |
| 88 | + * @param integer $id [the ID of the row record to be fetched.] | |
| 89 | + * @param \Mockery\MockInterface $query [The query to be used for the database communication.] | |
| 90 | 90 | * | 
| 91 | 91 | * @return [type] [The returned value of finding the record with the given ID.] | 
| 92 | 92 | */ | 
| @@ -145,8 +145,8 @@ discard block | ||
| 145 | 145 | /** | 
| 146 | 146 | * Destroy a recored or row from a database table. | 
| 147 | 147 | * | 
| 148 | - * @param [type] $id [The ID of the record to be deleted.] | |
| 149 | - * @param [type] $query [The query to handle to deleting operation] | |
| 148 | + * @param integer $id [The ID of the record to be deleted.] | |
| 149 | + * @param \Mockery\MockInterface $query [The query to handle to deleting operation] | |
| 150 | 150 | * | 
| 151 | 151 | * @return [type] [An array of all the records in that table without the deleted recode.] | 
| 152 | 152 | */ | 
| @@ -162,7 +162,7 @@ discard block | ||
| 162 | 162 | /** | 
| 163 | 163 | * [getClassTableName Get the name of the class from which this function is called, including classes that inherit from this class.]. | 
| 164 | 164 | * | 
| 165 | - * @return [type] [description] | |
| 165 | + * @return string [description] | |
| 166 | 166 | */ | 
| 167 | 167 | public static function getClassTableName() | 
| 168 | 168 |      { | 
| @@ -93,7 +93,7 @@ discard block | ||
| 93 | 93 | /** | 
| 94 | 94 | * Try executoing a query given the statment. | 
| 95 | 95 | * | 
| 96 | - * @param PDOStatemetn $statement The PDO statment to be executed. | |
| 96 | + * @param \PDOStatement $statement The PDO statment to be executed. | |
| 97 | 97 | * | 
| 98 | 98 | * @return bool The result of executing a query. True for success, false for failure | 
| 99 | 99 | */ | 
| @@ -136,7 +136,7 @@ discard block | ||
| 136 | 136 | /** | 
| 137 | 137 | * Bind parameters to the placeholders in the SQL queries. This is to avoid sql injection. | 
| 138 | 138 | * | 
| 139 | - * @param [type] $statement The PDOStatement to be used to the binding. | |
| 139 | + * @param \PDOStatement $statement The PDOStatement to be used to the binding. | |
| 140 | 140 | * @param [array] $values The result of binding parameters to an SQL query. | 
| 141 | 141 | */ | 
| 142 | 142 | public function setBindForInsert($statement, $values) | 
| @@ -150,8 +150,8 @@ discard block | ||
| 150 | 150 | /** | 
| 151 | 151 | * Delete a record form a database table. | 
| 152 | 152 | * | 
| 153 | - * @param [string] $table The table to be deleted from | |
| 154 | - * @param [int] $id the ID of the record to be deleted | |
| 153 | + * @param string $table The table to be deleted from | |
| 154 | + * @param integer $id the ID of the record to be deleted | |
| 155 | 155 | * | 
| 156 | 156 | * @return [type] The result of the deletion execution. | 
| 157 | 157 | */ | 
| @@ -192,8 +192,7 @@ discard block | ||
| 192 | 192 | /** | 
| 193 | 193 | * Bind parameters to the placeholders in the SQL queries. This is to avoid sql injection. | 
| 194 | 194 | * | 
| 195 | - * @param [type] $statement The PDOStatement to be used to the binding. | |
| 196 | - * @param [array] $values The result of binding parameters to an SQL query. | |
| 195 | + * @param \PDOStatement $statement The PDOStatement to be used to the binding. | |
| 197 | 196 | */ | 
| 198 | 197 | public function setBindForUpdate($statement, array $data) | 
| 199 | 198 |      { | 
| @@ -255,8 +254,8 @@ discard block | ||
| 255 | 254 | * [throwNoRecordException Throw an Exception if there is no record found in the database table.] | 
| 256 | 255 | * This may mean that the table is empty ot that the record with the given ID is not foung. | 
| 257 | 256 | * | 
| 258 | - * @param [string] $table [The table that is empty or does not have the record with the given ID.] | |
| 259 | - * @param [int] $id [The ID of the record that does not exist in the databse table] | |
| 257 | + * @param string $table [The table that is empty or does not have the record with the given ID.] | |
| 258 | + * @param integer $id [The ID of the record that does not exist in the databse table] | |
| 260 | 259 | * | 
| 261 | 260 | * @return [type] [description] | 
| 262 | 261 | */ | 
| @@ -81,7 +81,7 @@ discard block | ||
| 81 | 81 |      { | 
| 82 | 82 | $columnsString = $this->getColumns($data); | 
| 83 | 83 | $count = (int) count($data); | 
| 84 | -        $sql = "INSERT INTO $table $columnsString VALUES (".$this->putQuesMarks($count).')'; | |
| 84 | +        $sql = "INSERT INTO $table $columnsString VALUES (" . $this->putQuesMarks($count) . ')'; | |
| 85 | 85 | $statement = $this->connection->prepare($sql); | 
| 86 | 86 | $statement == false ? $this->throwFaultyOrNoTableException($table) : ''; | 
| 87 | 87 | $this->setBindForInsert($statement, array_values($data)); | 
| @@ -130,7 +130,7 @@ discard block | ||
| 130 | 130 | */ | 
| 131 | 131 | public function getColumns(array $data) | 
| 132 | 132 |      { | 
| 133 | -        return '('.implode(', ', array_keys($data)).')'; | |
| 133 | +        return '(' . implode(', ', array_keys($data)) . ')'; | |
| 134 | 134 | } | 
| 135 | 135 | |
| 136 | 136 | /** | 
| @@ -179,7 +179,7 @@ discard block | ||
| 179 | 179 | $id = (int) $data['id']; // store the id in a variable. | 
| 180 | 180 | unset($data['id']); | 
| 181 | 181 | $upd = (string) $this->makeModify(array_keys($data)); // genertate the columns for the update statement. | 
| 182 | -        $sql = "UPDATE {$table} SET ".$upd.' WHERE id = :id_val'; | |
| 182 | +        $sql = "UPDATE {$table} SET " . $upd . ' WHERE id = :id_val'; | |
| 183 | 183 | $statement = $this->connection->prepare($sql); | 
| 184 | 184 | $statement == false ? $this->throwFaultyOrNoTableException($table) : ''; | 
| 185 | 185 | $this->setBindForUpdate($statement, $data); | 
| @@ -199,7 +199,7 @@ discard block | ||
| 199 | 199 |      { | 
| 200 | 200 | $count = count($data); | 
| 201 | 201 |          foreach ($data as $key => $value) { | 
| 202 | -            $statement->bindValue(":$key".'_val', $value); | |
| 202 | +            $statement->bindValue(":$key" . '_val', $value); | |
| 203 | 203 | } | 
| 204 | 204 | } | 
| 205 | 205 | |
| @@ -215,7 +215,7 @@ discard block | ||
| 215 | 215 | $count = count($columns); | 
| 216 | 216 | $updateString = ''; // Start with an empty string | 
| 217 | 217 |          foreach ($columns as $column) { | 
| 218 | - $updateString .= $column.' = '.':'.$column.'_val, '; | |
| 218 | + $updateString .= $column . ' = ' . ':' . $column . '_val, '; | |
| 219 | 219 | } | 
| 220 | 220 | |
| 221 | 221 | return $updateString = trim($updateString, ', '); |