Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 9
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
TaskAttribute
0.00% covered (danger)
0.00%
0 / 9
0.00% covered (danger)
0.00%
0 / 3
12
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 toArray
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 1
2
 jsonSerialize
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2/**
3 * Jingga
4 *
5 * PHP Version 8.1
6 *
7 * @package   Modules\Tasks\Models
8 * @copyright Dennis Eichhorn
9 * @license   OMS License 2.0
10 * @version   1.0.0
11 * @link      https://jingga.app
12 */
13declare(strict_types=1);
14
15namespace Modules\Tasks\Models;
16
17/**
18 * Task class.
19 *
20 * @package Modules\Tasks\Models
21 * @license OMS License 2.0
22 * @link    https://jingga.app
23 * @since   1.0.0
24 */
25class TaskAttribute implements \JsonSerializable
26{
27    /**
28     * Id.
29     *
30     * @var int
31     * @since 1.0.0
32     */
33    public int $id = 0;
34
35    /**
36     * Task this attribute belongs to
37     *
38     * @var int
39     * @since 1.0.0
40     */
41    public int $task = 0;
42
43    /**
44     * Attribute type the attribute belongs to
45     *
46     * @var TaskAttributeType
47     * @since 1.0.0
48     */
49    public TaskAttributeType $type;
50
51    /**
52     * Attribute value the attribute belongs to
53     *
54     * @var TaskAttributeValue
55     * @since 1.0.0
56     */
57    public TaskAttributeValue $value;
58
59    /**
60     * Constructor.
61     *
62     * @since 1.0.0
63     */
64    public function __construct()
65    {
66        $this->type  = new NullTaskAttributeType();
67        $this->value = new NullTaskAttributeValue();
68    }
69
70    /**
71     * {@inheritdoc}
72     */
73    public function toArray() : array
74    {
75        return [
76            'id'    => $this->id,
77            'task'  => $this->task,
78            'type'  => $this->type,
79            'value' => $this->value,
80        ];
81    }
82
83    /**
84     * {@inheritdoc}
85     */
86    public function jsonSerialize() : mixed
87    {
88        return $this->toArray();
89    }
90}