Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
93.33% |
14 / 15 |
|
50.00% |
1 / 2 |
CRAP | |
0.00% |
0 / 1 |
| FileElement | |
93.33% |
14 / 15 |
|
50.00% |
1 / 2 |
3.00 | |
0.00% |
0 / 1 |
| __construct | |
100.00% |
11 / 11 |
|
100.00% |
1 / 1 |
1 | |||
| setCreatedAt | |
75.00% |
3 / 4 |
|
0.00% |
0 / 1 |
2.06 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | /** |
| 5 | * SPDX-FileCopyrightText: 2020-2024 LibreCode coop and contributors |
| 6 | * SPDX-License-Identifier: AGPL-3.0-or-later |
| 7 | */ |
| 8 | |
| 9 | namespace OCA\Libresign\Db; |
| 10 | |
| 11 | use OCP\AppFramework\Db\Entity; |
| 12 | use OCP\DB\Types; |
| 13 | |
| 14 | /** |
| 15 | * @method int getId() |
| 16 | * @method void setId(int $id) |
| 17 | * @method int getFileId() |
| 18 | * @method void setFileId(int $fileId) |
| 19 | * @method int getSignRequestId() |
| 20 | * @method void setSignRequestId(int $signRequestId) |
| 21 | * @method string getType() |
| 22 | * @method void setType(string $type) |
| 23 | * @method ?array getMetadata() |
| 24 | * @method void setMetadata(array $metadata) |
| 25 | * @method int getPage() |
| 26 | * @method void setPage(int $page) |
| 27 | * @method int getUrx() |
| 28 | * @method void setUrx(int $urx) |
| 29 | * @method int getUry() |
| 30 | * @method void setUry(int $ury) |
| 31 | * @method ?int getLlx() |
| 32 | * @method void setLlx(int $llx) |
| 33 | * @method ?int getLly() |
| 34 | * @method void setLly(int $lly) |
| 35 | * @method ?\DateTime getCreatedAt() |
| 36 | */ |
| 37 | class FileElement extends Entity { |
| 38 | protected int $fileId = 0; |
| 39 | protected int $signRequestId = 0; |
| 40 | protected string $type = ''; |
| 41 | protected ?array $metadata = null; |
| 42 | protected int $page = 0; |
| 43 | protected int $urx = 0; |
| 44 | protected int $ury = 0; |
| 45 | protected ?int $llx = null; |
| 46 | protected ?int $lly = null; |
| 47 | protected ?\DateTime $createdAt = null; |
| 48 | public function __construct() { |
| 49 | $this->addType('id', Types::INTEGER); |
| 50 | $this->addType('fileId', Types::INTEGER); |
| 51 | $this->addType('signRequestId', Types::INTEGER); |
| 52 | $this->addType('type', Types::STRING); |
| 53 | $this->addType('metadata', Types::JSON); |
| 54 | $this->addType('page', Types::INTEGER); |
| 55 | $this->addType('urx', Types::INTEGER); |
| 56 | $this->addType('ury', Types::INTEGER); |
| 57 | $this->addType('llx', Types::INTEGER); |
| 58 | $this->addType('lly', Types::INTEGER); |
| 59 | $this->addType('createdAt', Types::DATETIME); |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * @param \DateTime|string $createdAt |
| 64 | */ |
| 65 | public function setCreatedAt($createdAt): void { |
| 66 | if (!$createdAt instanceof \DateTime) { |
| 67 | $createdAt = new \DateTime($createdAt, new \DateTimeZone('UTC')); |
| 68 | } |
| 69 | $this->createdAt = $createdAt; |
| 70 | $this->markFieldUpdated('createdAt'); |
| 71 | } |
| 72 | } |