@@ -82,6 +82,7 @@ discard block |
||
| 82 | 82 | /** |
| 83 | 83 | * getTableName() |
| 84 | 84 | * |
| 85 | + * @param string $connection |
|
| 85 | 86 | * @return string |
| 86 | 87 | */ |
| 87 | 88 | protected function getTableName($connection) |
@@ -122,7 +123,7 @@ discard block |
||
| 122 | 123 | * @param $tablename |
| 123 | 124 | * @param $con |
| 124 | 125 | * |
| 125 | - * @return bool |
|
| 126 | + * @return boolean|null |
|
| 126 | 127 | */ |
| 127 | 128 | public function checkTableExist($table, $con=NULL) |
| 128 | 129 | { |
@@ -137,7 +138,7 @@ discard block |
||
| 137 | 138 | /** |
| 138 | 139 | * checkTableName Return the table name |
| 139 | 140 | * |
| 140 | - * @param $tablename |
|
| 141 | + * @param string $tablename |
|
| 141 | 142 | * @param $con |
| 142 | 143 | * |
| 143 | 144 | * @return string |
@@ -158,7 +159,7 @@ discard block |
||
| 158 | 159 | * checkColumn Check if column exist in table |
| 159 | 160 | * |
| 160 | 161 | * @param $tableName |
| 161 | - * @param $columnName |
|
| 162 | + * @param string $columnName |
|
| 162 | 163 | * @param $con |
| 163 | 164 | * |
| 164 | 165 | * @return string |
@@ -315,6 +316,9 @@ discard block |
||
| 315 | 316 | /** |
| 316 | 317 | * selectQuery |
| 317 | 318 | * |
| 319 | + * @param string $tableName |
|
| 320 | + * @param string $fields |
|
| 321 | + * @param string $connection |
|
| 318 | 322 | * @return string |
| 319 | 323 | */ |
| 320 | 324 | public static function selectQuery($tableName, $fields, $data, $condition, $connection) |
@@ -342,6 +346,7 @@ discard block |
||
| 342 | 346 | /** |
| 343 | 347 | * insertQuery |
| 344 | 348 | * |
| 349 | + * @param string $tableName |
|
| 345 | 350 | * @return string |
| 346 | 351 | */ |
| 347 | 352 | public function insertQuery($tableName) |
@@ -358,6 +363,7 @@ discard block |
||
| 358 | 363 | /** |
| 359 | 364 | * updateQuery |
| 360 | 365 | * |
| 366 | + * @param string $tableName |
|
| 361 | 367 | * @return string |
| 362 | 368 | */ |
| 363 | 369 | public function updateQuery($tableName) |
@@ -375,7 +381,8 @@ discard block |
||
| 375 | 381 | * query($query, $dbCOnnection) |
| 376 | 382 | * Raw sql query |
| 377 | 383 | * |
| 378 | - * @return object |
|
| 384 | + * @param string $query |
|
| 385 | + * @return GetData |
|
| 379 | 386 | */ |
| 380 | 387 | public function query($query, $con = NULL) |
| 381 | 388 | { |
@@ -25,7 +25,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | { |
@@ -41,6 +41,9 @@ |
||
| 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(); |
@@ -25,36 +25,36 @@ |
||
| 25 | 25 | $i = 0; |
| 26 | 26 | |
| 27 | 27 | if ($data[0]->REFERENCED_TABLE_NAME !== null) { |
| 28 | - $arraySize = count($data); |
|
| 29 | - |
|
| 30 | - foreach($data as $key => $value) { |
|
| 31 | - $output .= ' JOIN '.$value->REFERENCED_TABLE_NAME; |
|
| 32 | - } |
|
| 33 | - foreach($data as $key => $value) { |
|
| 34 | - $i++; |
|
| 35 | - $whereAnd = $i > 1 ? 'AND' : 'WHERE'; |
|
| 36 | - $output .= ' '.$whereAnd.' '.self::getTableName($connection).'.'.$value->COLUMN_NAME.'='.$value->REFERENCED_TABLE_NAME.'.'.$value->REFERENCED_COLUMN_NAME.' '; |
|
| 37 | - } |
|
| 38 | - } else { |
|
| 39 | - $output = false; |
|
| 40 | - } |
|
| 28 | + $arraySize = count($data); |
|
| 29 | + |
|
| 30 | + foreach($data as $key => $value) { |
|
| 31 | + $output .= ' JOIN '.$value->REFERENCED_TABLE_NAME; |
|
| 32 | + } |
|
| 33 | + foreach($data as $key => $value) { |
|
| 34 | + $i++; |
|
| 35 | + $whereAnd = $i > 1 ? 'AND' : 'WHERE'; |
|
| 36 | + $output .= ' '.$whereAnd.' '.self::getTableName($connection).'.'.$value->COLUMN_NAME.'='.$value->REFERENCED_TABLE_NAME.'.'.$value->REFERENCED_COLUMN_NAME.' '; |
|
| 37 | + } |
|
| 38 | + } else { |
|
| 39 | + $output = false; |
|
| 40 | + } |
|
| 41 | 41 | return $output; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | public function whereClause($data = null, $condition = null, $con = null) |
| 45 | 45 | { |
| 46 | - $joinClause = self::joinClause(); |
|
| 46 | + $joinClause = self::joinClause(); |
|
| 47 | 47 | $connection = self::checkConnection($con); |
| 48 | 48 | $tableName = self::getTableName($connection); |
| 49 | 49 | $columnName = self::whereAndClause($tableName, $data, $condition); |
| 50 | 50 | |
| 51 | - $query = 'SELECT * FROM '.$tableName; |
|
| 51 | + $query = 'SELECT * FROM '.$tableName; |
|
| 52 | 52 | |
| 53 | - if (! $joinClause) { |
|
| 54 | - $query .= ' WHERE '.$columnName; |
|
| 55 | - } else { |
|
| 56 | - $query .= ($data === null) ? $joinClause : $joinClause .' AND '.$columnName; |
|
| 57 | - } |
|
| 58 | - return $query; |
|
| 53 | + if (! $joinClause) { |
|
| 54 | + $query .= ' WHERE '.$columnName; |
|
| 55 | + } else { |
|
| 56 | + $query .= ($data === null) ? $joinClause : $joinClause .' AND '.$columnName; |
|
| 57 | + } |
|
| 58 | + return $query; |
|
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | \ No newline at end of file |
@@ -83,8 +83,8 @@ discard block |
||
| 83 | 83 | /** |
| 84 | 84 | *@method bool ValidateExtension() returns whether the extension of file to be uploaded |
| 85 | 85 | * is allowable or not. |
| 86 | - *@return true the extension is valid. |
|
| 87 | - *@return false the extension is invalid. |
|
| 86 | + *@return boolean the extension is valid. |
|
| 87 | + *@return boolean the extension is invalid. |
|
| 88 | 88 | */ |
| 89 | 89 | public function ValidateExtension() |
| 90 | 90 | { |
@@ -115,8 +115,8 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | /** |
| 117 | 117 | *@method bool ValidateSize() returns whether the file size is acceptable. |
| 118 | - *@return true the size is smaller than the alloted value. |
|
| 119 | - *@return false the size is larger than the alloted value. |
|
| 118 | + *@return boolean the size is smaller than the alloted value. |
|
| 119 | + *@return boolean the size is larger than the alloted value. |
|
| 120 | 120 | */ |
| 121 | 121 | public function ValidateSize() |
| 122 | 122 | { |
@@ -140,8 +140,8 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | /** |
| 142 | 142 | *@method bool ValidateExistance() determins whether the file already exists. If so, rename $FileName. |
| 143 | - *@return true can never be returned as all file names must be unique. |
|
| 144 | - *@return false the file name does not exist. |
|
| 143 | + *@return null|false can never be returned as all file names must be unique. |
|
| 144 | + *@return null|false the file name does not exist. |
|
| 145 | 145 | */ |
| 146 | 146 | public function ValidateExistance($uploadDirectory) |
| 147 | 147 | { |
@@ -161,8 +161,8 @@ discard block |
||
| 161 | 161 | |
| 162 | 162 | /** |
| 163 | 163 | *@method bool ValidateDirectory() |
| 164 | - *@return true the UploadDirectory exists, writable, and has a traling slash. |
|
| 165 | - *@return false the directory was never set, does not exist, or is not writable. |
|
| 164 | + *@return null|boolean the UploadDirectory exists, writable, and has a traling slash. |
|
| 165 | + *@return null|boolean the directory was never set, does not exist, or is not writable. |
|
| 166 | 166 | */ |
| 167 | 167 | public function ValidateDirectory($uploadDirectory) |
| 168 | 168 | { |
@@ -194,8 +194,8 @@ discard block |
||
| 194 | 194 | |
| 195 | 195 | /** |
| 196 | 196 | *@method bool ValidateImage() |
| 197 | - *@return true the image is smaller than the alloted dimensions. |
|
| 198 | - *@return false the width and/or height is larger then the alloted dimensions. |
|
| 197 | + *@return boolean the image is smaller than the alloted dimensions. |
|
| 198 | + *@return boolean the width and/or height is larger then the alloted dimensions. |
|
| 199 | 199 | */ |
| 200 | 200 | public function ValidateImage() { |
| 201 | 201 | $MaximumWidth = $this->MaximumWidth; |
@@ -311,6 +311,9 @@ discard block |
||
| 311 | 311 | return $this->UploadDirectory; |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | + /** |
|
| 315 | + * @return string |
|
| 316 | + */ |
|
| 314 | 317 | public function GetTempName() |
| 315 | 318 | { |
| 316 | 319 | return $this->output['tmp_name']; |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | |
| 12 | 12 | interface RelationshipsInterface |
| 13 | 13 | { |
| 14 | - public function joinClause(); |
|
| 14 | + public function joinClause(); |
|
| 15 | 15 | |
| 16 | 16 | public function whereClause($data, $condition); |
| 17 | 17 | } |
| 18 | 18 | \ No newline at end of file |