Webhook::team()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Spinen\ClickUp;
4
5
use Spinen\ClickUp\Exceptions\InvalidRelationshipException;
6
use Spinen\ClickUp\Exceptions\ModelNotFoundException;
7
use Spinen\ClickUp\Exceptions\NoClientException;
8
use Spinen\ClickUp\Support\Model;
9
use Spinen\ClickUp\Support\Relations\BelongsTo;
10
use Spinen\ClickUp\Support\Relations\ChildOf;
11
12
/**
13
 * Class Webhook
14
 *
15
 * @package Spinen\ClickUp
16
 *
17
 * @property array $events
18
 * @property integer $folder_id
19
 * @property integer $list_id
20
 * @property integer $space_id
21
 * @property integer $team_id
22
 * @property integer $userid
23
 * @property string $id
24
 */
25
class Webhook extends Model
26
{
27
    /**
28
     * The attributes that should be cast to native types.
29
     *
30
     * @var array
31
     */
32
    protected $casts = [
33
        'folder_id' => 'integer',
34
        'id'        => 'string',
35
        'list_id'   => 'integer',
36
        'space_id'  => 'integer',
37
        'team_id'   => 'integer',
38
        'userid'    => 'integer',
39
    ];
40
41
    /**
42
     * Path to API endpoint.
43
     *
44
     * @var string
45
     */
46
    protected $path = '/webhook';
47
48
    /**
49
     * @return BelongsTo
50
51
     * @throws InvalidRelationshipException
52
     * @throws ModelNotFoundException
53
     * @throws NoClientException
54
     */
55 1
    public function folder(): BelongsTo
56
    {
57 1
        return $this->belongsTo(Folder::class);
58
    }
59
60
    /**
61
     * @return BelongsTo
62
     * @throws InvalidRelationshipException
63
     * @throws ModelNotFoundException
64
     * @throws NoClientException
65
     */
66 1
    public function list(): BelongsTo
67
    {
68 1
        return $this->belongsTo(TaskList::class);
69
    }
70
71
    /**
72
     * @return BelongsTo
73
     * @throws InvalidRelationshipException
74
     * @throws ModelNotFoundException
75
     * @throws NoClientException
76
     */
77 1
    public function space(): BelongsTo
78
    {
79 1
        return $this->belongsTo(Space::class);
80
    }
81
82
    /**
83
     * @return ChildOf
84
     * @throws InvalidRelationshipException
85
     * @throws ModelNotFoundException
86
     * @throws NoClientException
87
     */
88 1
    public function team(): ChildOf
89
    {
90 1
        return $this->childOf(Team::class);
91
    }
92
93
    /**
94
     * @return BelongsTo
95
     * @throws InvalidRelationshipException
96
     * @throws ModelNotFoundException
97
     * @throws NoClientException
98
     */
99 1
    public function user(): BelongsTo
100
    {
101 1
        return $this->belongsTo(Member::class, 'userid');
102
    }
103
}
104