| @@ -1,35 +1,95 @@ | ||
| 1 | 1 | <?php |
| 2 | +/** | |
| 3 | + * FileObject.php | |
| 4 | + * | |
| 5 | + * The FileObject class file. | |
| 6 | + * | |
| 7 | + * PHP versions 5 | |
| 8 | + * | |
| 9 | + * @author Alexander Schneider <alexanderschneider85@gmail.com> | |
| 10 | + * @copyright 2008-2017 Alexander Schneider | |
| 11 | + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 | |
| 12 | + * @version SVN: $id$ | |
| 13 | + * @link http://wordpress.org/extend/plugins/user-access-manager/ | |
| 14 | + */ | |
| 2 | 15 | |
| 3 | 16 | declare(strict_types=1); |
| 4 | 17 | |
| 5 | 18 | namespace UserAccessManager\File; |
| 6 | 19 | |
| 20 | +/** | |
| 21 | + * Class FileObject | |
| 22 | + * @package UserAccessManager\FileHandler | |
| 23 | + */ | |
| 7 | 24 | class FileObject |
| 8 | 25 | { |
| 9 | - public function __construct( | |
| 10 | - private int|string $id, | |
| 11 | - private string $type, | |
| 12 | - private string $file, | |
| 13 | - private bool $isImage = false | |
| 14 | - ) { | |
| 26 | + /** | |
| 27 | + * @var string | |
| 28 | + */ | |
| 29 | + private $id; | |
| 30 | + | |
| 31 | + /** | |
| 32 | + * @var string | |
| 33 | + */ | |
| 34 | + private $type; | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * @var string | |
| 38 | + */ | |
| 39 | + private $file; | |
| 40 | + | |
| 41 | + /** | |
| 42 | + * @var bool | |
| 43 | + */ | |
| 44 | + private $isImage; | |
| 45 | + | |
| 46 | + /** | |
| 47 | + * FileObject constructor. | |
| 48 | + * @param string $id | |
| 49 | + * @param string $type | |
| 50 | + * @param string $file | |
| 51 | + * @param bool $isImage | |
| 52 | + */ | |
| 53 | + public function __construct(string $id, string $type, string $file, $isImage = false) | |
| 54 | + { | |
| 55 | + $this->id = $id; | |
| 56 | + $this->type = $type; | |
| 57 | + $this->file = $file; | |
| 58 | + $this->isImage = $isImage; | |
| 15 | 59 | } |
| 16 | 60 | |
| 17 | - public function getId(): int|string | |
| 61 | + /** | |
| 62 | + * Returns the file object id. | |
| 63 | + * @return string|int | |
| 64 | + */ | |
| 65 | + public function getId() | |
| 18 | 66 | { |
| 19 | 67 | return $this->id; |
| 20 | 68 | } |
| 21 | 69 | |
| 70 | + /** | |
| 71 | + * Returns the file object type. | |
| 72 | + * @return string | |
| 73 | + */ | |
| 22 | 74 | public function getType(): string |
| 23 | 75 | { |
| 24 | 76 | return $this->type; |
| 25 | 77 | } |
| 26 | 78 | |
| 79 | + /** | |
| 80 | + * Returns the file object file. | |
| 81 | + * @return string | |
| 82 | + */ | |
| 27 | 83 | public function getFile(): string |
| 28 | 84 | { |
| 29 | 85 | return $this->file; |
| 30 | 86 | } |
| 31 | 87 | |
| 88 | + /** | |
| 89 | + * Returns true if the file is a image. | |
| 90 | + * @return bool | |
| 91 | + */ | |
| 32 | 92 | public function isImage(): bool |
| 33 | 93 | { |
| 34 | 94 | return $this->isImage; |
| 35 | 95 | } |