Member::list()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 2
nc 2
nop 0
crap 2
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\ChildOf;
10
11
/**
12
 * Class Member
13
 *
14
 * @package Spinen\ClickUp
15
 *
16
 * @property integer $id
17
 * @property integer $role
18
 * @property string $color
19
 * @property string $email
20
 * @property string $initials
21
 * @property string $profilePicture
22
 * @property string $username
23
 * @property Task $task
24
 * @property TaskList $list
25
 */
26
class Member extends Model
27
{
28
    /**
29
     * The attributes that should be cast to native types.
30
     *
31
     * @var array
32
     */
33
    protected $casts = [
34
        'id'   => 'integer',
35
        'role' => 'integer',
36
    ];
37
38
    /**
39
     * Path to API endpoint.
40
     *
41
     * @var string
42
     */
43
    protected $path = '/member';
44
45
    /**
46
     * @return ChildOf
47
     * @throws InvalidRelationshipException
48
     * @throws ModelNotFoundException
49
     * @throws NoClientException
50
     */
51 2
    public function list(): ?ChildOf
52
    {
53 2
        return is_a($this->parentModel, TaskList::class) ? $this->childOf(TaskList::class) : null;
54
    }
55
56
    /**
57
     * @return ChildOf
58
     * @throws InvalidRelationshipException
59
     * @throws ModelNotFoundException
60
     * @throws NoClientException
61
     */
62 2
    public function task(): ?ChildOf
63
    {
64 2
        return is_a($this->parentModel, Task::class) ? $this->childOf(Task::class) : null;
65
    }
66
}
67