@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Defining Interface for class DatabaseQueryInterface. |
|
| 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 DatabaseQueryInterface. |
|
| 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 | |
@@ -1,11 +1,11 @@ |
||
| 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 | |
@@ -1,11 +1,11 @@ |
||
| 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 | |
@@ -25,6 +25,6 @@ |
||
| 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 |
@@ -1,11 +1,11 @@ |
||
| 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 | |
@@ -25,6 +25,6 @@ |
||
| 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 |
@@ -53,8 +53,8 @@ |
||
| 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 |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | /** |
| 63 | 63 | *@method bool ValidateExtension() returns whether the extension of file to be uploaded |
| 64 | 64 | * is allowable or not. |
| 65 | - *@return true the extension is valid. |
|
| 66 | - *@return false the extension is invalid. |
|
| 65 | + *@return boolean the extension is valid. |
|
| 66 | + *@return boolean the extension is invalid. |
|
| 67 | 67 | */ |
| 68 | 68 | public function ValidateExtension() |
| 69 | 69 | { |
@@ -95,8 +95,8 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | /** |
| 97 | 97 | *@method bool ValidateSize() returns whether the file size is acceptable. |
| 98 | - *@return true the size is smaller than the alloted value. |
|
| 99 | - *@return false the size is larger than the alloted value. |
|
| 98 | + *@return boolean the size is smaller than the alloted value. |
|
| 99 | + *@return boolean the size is larger than the alloted value. |
|
| 100 | 100 | */ |
| 101 | 101 | public function ValidateSize() |
| 102 | 102 | { |
@@ -120,8 +120,8 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | /** |
| 122 | 122 | *@method bool ValidateExistance() determins whether the file already exists. If so, rename $FileName. |
| 123 | - *@return true can never be returned as all file names must be unique. |
|
| 124 | - *@return false the file name does not exist. |
|
| 123 | + *@return null|false can never be returned as all file names must be unique. |
|
| 124 | + *@return null|false the file name does not exist. |
|
| 125 | 125 | */ |
| 126 | 126 | public function ValidateExistance() |
| 127 | 127 | { |
@@ -142,8 +142,8 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | /** |
| 144 | 144 | *@method bool ValidateDirectory() |
| 145 | - *@return true the UploadDirectory exists, writable, and has a traling slash. |
|
| 146 | - *@return false the directory was never set, does not exist, or is not writable. |
|
| 145 | + *@return null|boolean the UploadDirectory exists, writable, and has a traling slash. |
|
| 146 | + *@return null|boolean the directory was never set, does not exist, or is not writable. |
|
| 147 | 147 | */ |
| 148 | 148 | public function ValidateDirectory() |
| 149 | 149 | { |
@@ -177,8 +177,8 @@ discard block |
||
| 177 | 177 | |
| 178 | 178 | /** |
| 179 | 179 | *@method bool ValidateImage() |
| 180 | - *@return true the image is smaller than the alloted dimensions. |
|
| 181 | - *@return false the width and/or height is larger then the alloted dimensions. |
|
| 180 | + *@return boolean the image is smaller than the alloted dimensions. |
|
| 181 | + *@return boolean the width and/or height is larger then the alloted dimensions. |
|
| 182 | 182 | */ |
| 183 | 183 | public function ValidateImage() { |
| 184 | 184 | $MaximumWidth = $this->MaximumWidth; |
@@ -206,8 +206,8 @@ discard block |
||
| 206 | 206 | |
| 207 | 207 | /** |
| 208 | 208 | *@method bool UploadFile() uploads the file to the server after passing all the validations. |
| 209 | - *@return true the file was uploaded. |
|
| 210 | - *@return false the upload failed. |
|
| 209 | + *@return null|boolean the file was uploaded. |
|
| 210 | + *@return null|boolean the upload failed. |
|
| 211 | 211 | */ |
| 212 | 212 | public function uploadFile() |
| 213 | 213 | { |
@@ -251,11 +251,18 @@ discard block |
||
| 251 | 251 | |
| 252 | 252 | #Accessors and Mutators beyond this point. |
| 253 | 253 | #Siginificant documentation is not needed. |
| 254 | + |
|
| 255 | + /** |
|
| 256 | + * @param string $argv |
|
| 257 | + */ |
|
| 254 | 258 | public function SetFileName($argv) |
| 255 | 259 | { |
| 256 | 260 | $this->FileName = $argv; |
| 257 | 261 | } |
| 258 | 262 | |
| 263 | + /** |
|
| 264 | + * @param string $argv |
|
| 265 | + */ |
|
| 259 | 266 | public function SetUploadDirectory($argv) |
| 260 | 267 | { |
| 261 | 268 | $this->UploadDirectory = $argv; |
@@ -310,6 +317,9 @@ discard block |
||
| 310 | 317 | return $this->UploadDirectory; |
| 311 | 318 | } |
| 312 | 319 | |
| 320 | + /** |
|
| 321 | + * @return string |
|
| 322 | + */ |
|
| 313 | 323 | public function GetTempName() |
| 314 | 324 | { |
| 315 | 325 | return $this->TempFileName; |
@@ -73,12 +73,12 @@ discard block |
||
| 73 | 73 | $Extension = strtolower($FileParts['extension']); |
| 74 | 74 | $ValidExtensions = $this->ValidExtensions; |
| 75 | 75 | |
| 76 | - if (!$FileName) { |
|
| 76 | + if ( ! $FileName) { |
|
| 77 | 77 | $this->SetMessage("ERROR: File name is empty."); |
| 78 | 78 | return false; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - if (!$ValidExtensions) { |
|
| 81 | + if ( ! $ValidExtensions) { |
|
| 82 | 82 | $this->SetMessage("WARNING: All extensions are valid."); |
| 83 | 83 | return true; |
| 84 | 84 | } |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | $TempFileName = $this->GetTempName(); |
| 105 | 105 | $TempFileSize = filesize($TempFileName); |
| 106 | 106 | |
| 107 | - if($MaximumFileSize == "") { |
|
| 107 | + if ($MaximumFileSize == "") { |
|
| 108 | 108 | $this->SetMessage("WARNING: There is no size restriction."); |
| 109 | 109 | return true; |
| 110 | 110 | } |
@@ -127,11 +127,11 @@ discard block |
||
| 127 | 127 | { |
| 128 | 128 | $FileName = $this->FileName; |
| 129 | 129 | $UploadDirectory = $this->UploadDirectory; |
| 130 | - $File = $UploadDirectory . $FileName; |
|
| 130 | + $File = $UploadDirectory.$FileName; |
|
| 131 | 131 | |
| 132 | 132 | if (file_exists($File)) { |
| 133 | 133 | $this->SetMessage("Message: The file '$FileName' already exist."); |
| 134 | - $UniqueName = rand() . $FileName; |
|
| 134 | + $UniqueName = rand().$FileName; |
|
| 135 | 135 | $this->SetFileName($UniqueName); |
| 136 | 136 | $this->ValidateExistance(); |
| 137 | 137 | } else { |
@@ -149,24 +149,24 @@ discard block |
||
| 149 | 149 | { |
| 150 | 150 | $UploadDirectory = $this->UploadDirectory; |
| 151 | 151 | |
| 152 | - if (!$UploadDirectory) { |
|
| 152 | + if ( ! $UploadDirectory) { |
|
| 153 | 153 | $this->SetMessage("ERROR: The directory variable is empty."); |
| 154 | 154 | return false; |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - if (!is_dir($UploadDirectory)) { |
|
| 157 | + if ( ! is_dir($UploadDirectory)) { |
|
| 158 | 158 | $this->SetMessage("ERROR: The directory '$UploadDirectory' does not exist."); |
| 159 | 159 | return false; |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - if (!is_writable($UploadDirectory)) { |
|
| 162 | + if ( ! is_writable($UploadDirectory)) { |
|
| 163 | 163 | $this->SetMessage("ERROR: The directory '$UploadDirectory' does not writable."); |
| 164 | 164 | return false; |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | if (substr($UploadDirectory, -1) != "/") { |
| 168 | 168 | $this->SetMessage("ERROR: The traling slash does not exist."); |
| 169 | - $NewDirectory = $UploadDirectory . "/"; |
|
| 169 | + $NewDirectory = $UploadDirectory."/"; |
|
| 170 | 170 | $this->SetUploadDirectory($NewDirectory); |
| 171 | 171 | $this->ValidateDirectory(); |
| 172 | 172 | } else { |
@@ -185,9 +185,9 @@ discard block |
||
| 185 | 185 | $MaximumHeight = $this->MaximumHeight; |
| 186 | 186 | $TempFileName = $this->TempFileName; |
| 187 | 187 | |
| 188 | - if($Size = @getimagesize($TempFileName)) { |
|
| 189 | - $Width = $Size[0]; //$Width is the width in pixels of the image uploaded to the server. |
|
| 190 | - $Height = $Size[1]; //$Height is the height in pixels of the image uploaded to the server. |
|
| 188 | + if ($Size = @getimagesize($TempFileName)) { |
|
| 189 | + $Width = $Size[0]; //$Width is the width in pixels of the image uploaded to the server. |
|
| 190 | + $Height = $Size[1]; //$Height is the height in pixels of the image uploaded to the server. |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | if ($Width > $MaximumWidth) { |
@@ -212,11 +212,11 @@ discard block |
||
| 212 | 212 | public function uploadFile() |
| 213 | 213 | { |
| 214 | 214 | |
| 215 | - if (!$this->ValidateExtension()) { |
|
| 215 | + if ( ! $this->ValidateExtension()) { |
|
| 216 | 216 | die($this->GetMessage()); |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | - else if (!$this->ValidateSize()) { |
|
| 219 | + else if ( ! $this->ValidateSize()) { |
|
| 220 | 220 | die($this->GetMessage()); |
| 221 | 221 | } |
| 222 | 222 | |
@@ -224,11 +224,11 @@ discard block |
||
| 224 | 224 | die($this->GetMessage()); |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | - else if (!$this->ValidateDirectory()) { |
|
| 227 | + else if ( ! $this->ValidateDirectory()) { |
|
| 228 | 228 | die($this->GetMessage()); |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | - else if ($this->IsImage && !$this->ValidateImage()) { |
|
| 231 | + else if ($this->IsImage && ! $this->ValidateImage()) { |
|
| 232 | 232 | die($this->GetMessage()); |
| 233 | 233 | } |
| 234 | 234 | |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | $UploadDirectory = $this->UploadDirectory; |
| 240 | 240 | |
| 241 | 241 | if (is_uploaded_file($TempFileName)) { |
| 242 | - move_uploaded_file($TempFileName, $UploadDirectory . $FileName); |
|
| 242 | + move_uploaded_file($TempFileName, $UploadDirectory.$FileName); |
|
| 243 | 243 | return true; |
| 244 | 244 | } else { |
| 245 | 245 | return false; |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | |
| 323 | 323 | public function GetMessage() |
| 324 | 324 | { |
| 325 | - if (!isset($this->Message)) { |
|
| 325 | + if ( ! isset($this->Message)) { |
|
| 326 | 326 | $this->SetMessage("No Message"); |
| 327 | 327 | } |
| 328 | 328 | |
@@ -214,25 +214,15 @@ |
||
| 214 | 214 | |
| 215 | 215 | if (!$this->ValidateExtension()) { |
| 216 | 216 | die($this->GetMessage()); |
| 217 | - } |
|
| 218 | - |
|
| 219 | - else if (!$this->ValidateSize()) { |
|
| 217 | + } else if (!$this->ValidateSize()) { |
|
| 220 | 218 | die($this->GetMessage()); |
| 221 | - } |
|
| 222 | - |
|
| 223 | - else if ($this->ValidateExistance()) { |
|
| 219 | + } else if ($this->ValidateExistance()) { |
|
| 224 | 220 | die($this->GetMessage()); |
| 225 | - } |
|
| 226 | - |
|
| 227 | - else if (!$this->ValidateDirectory()) { |
|
| 221 | + } else if (!$this->ValidateDirectory()) { |
|
| 228 | 222 | die($this->GetMessage()); |
| 229 | - } |
|
| 230 | - |
|
| 231 | - else if ($this->IsImage && !$this->ValidateImage()) { |
|
| 223 | + } else if ($this->IsImage && !$this->ValidateImage()) { |
|
| 232 | 224 | die($this->GetMessage()); |
| 233 | - } |
|
| 234 | - |
|
| 235 | - else { |
|
| 225 | + } else { |
|
| 236 | 226 | |
| 237 | 227 | $FileName = $this->FileName; |
| 238 | 228 | $TempFileName = $this->TempFileName; |
@@ -1,17 +1,17 @@ discard block |
||
| 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 | |
| 12 | 12 | interface GetDataInterface |
| 13 | 13 | { |
| 14 | - public function all(); |
|
| 14 | + public function all(); |
|
| 15 | 15 | |
| 16 | 16 | public function allDESC($limit); |
| 17 | 17 | |
@@ -23,5 +23,5 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | public function first(); |
| 25 | 25 | |
| 26 | - public function getCount(); |
|
| 26 | + public function getCount(); |
|
| 27 | 27 | } |