1<?php
2/*
3 * Yurii's Gantt Plugin
4 *
5 * Copyright (C) 2020 Yurii K.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program.  If not, see http://www.gnu.org/licenses
19 */
20
21namespace dokuwiki\plugin\yuriigantt\src\Entities;
22
23class Link
24{
25    /** @var int primary */
26    public $id;
27    /** @var int|null */
28    public $source;
29    /** @var int|null */
30    public $target;
31    /** @var string */
32    public $type;
33
34
35    /**
36     * Link constructor.
37     * @param \stdClass|null $data
38     */
39    public function __construct($data)
40    {
41        if (!$data) {
42            return;
43        }
44
45        $this->id = $data->id;
46        $this->source = isset($data->source) ? $data->source : null;
47        $this->target = isset($data->target) ? $data->target : null;
48        $this->type = $data->type;
49    }
50}
51