Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
3 / 3
CRAP
100.00% covered (success)
100.00%
1 / 1
PermissionSetBinding
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
3 / 3
4
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
1 / 1
1
 setCreatedAt
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
2
 getCreatedAt
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4/**
5 * SPDX-FileCopyrightText: 2026 LibreCode coop and contributors
6 * SPDX-License-Identifier: AGPL-3.0-or-later
7 */
8
9namespace OCA\Libresign\Db;
10
11use OCP\AppFramework\Db\Entity;
12use OCP\DB\Types;
13
14/**
15 * @method void setId(int $id)
16 * @method int getId()
17 * @method void setPermissionSetId(int $permissionSetId)
18 * @method int getPermissionSetId()
19 * @method void setTargetType(string $targetType)
20 * @method string getTargetType()
21 * @method void setTargetId(string $targetId)
22 * @method string getTargetId()
23 */
24class PermissionSetBinding extends Entity {
25    protected int $permissionSetId = 0;
26    protected string $targetType = '';
27    protected string $targetId = '';
28    protected ?\DateTime $createdAt = null;
29
30    public function __construct() {
31        $this->addType('id', Types::INTEGER);
32        $this->addType('permissionSetId', Types::INTEGER);
33        $this->addType('targetType', Types::STRING);
34        $this->addType('targetId', Types::STRING);
35        $this->addType('createdAt', Types::DATETIME);
36    }
37
38    /**
39     * @param \DateTime|string $createdAt
40     */
41    public function setCreatedAt($createdAt): void {
42        if (!$createdAt instanceof \DateTime) {
43            $createdAt = new \DateTime($createdAt, new \DateTimeZone('UTC'));
44        }
45        $this->createdAt = $createdAt;
46        $this->markFieldUpdated('createdAt');
47    }
48
49    public function getCreatedAt(): ?\DateTime {
50        return $this->createdAt;
51    }
52}