Completed
Push — master ( bb722b...3bdf28 )
by Nate
02:16
created

TypeIdAttributeTrait::getTypeId()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 0
cts 7
cp 0
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 6
1
<?php
2
3
/**
4
 * @copyright  Copyright (c) Flipbox Digital Limited
5
 * @license    https://github.com/flipbox/hubspot/blob/master/LICENSE.md
6
 * @link       https://github.com/flipbox/hubspot
7
 */
8
9
namespace Flipbox\HubSpot\Criteria;
10
11
/**
12
 * @author Flipbox Factory <[email protected]>
13
 * @since 2.0.0
14
 */
15
trait TypeIdAttributeTrait
16
{
17
    /**
18
     * The type Id
19
     *
20
     * @var string
21
     */
22
    protected $typeId;
23
24
    /**
25
     * @return string
26
     * @throws \Exception
27
     */
28
    public function getTypeId(): string
29
    {
30
        if (null === ($id = $this->findTypeId())) {
31
            throw new \Exception("Invalid Type Id");
32
        }
33
        return $id;
34
    }
35
36
    /**
37
     * @return string|null
38
     */
39
    public function findTypeId()
40
    {
41
        return $this->typeId;
42
    }
43
44
    /**
45
     * @param string|null $id
46
     * @return $this
47
     */
48
    public function setTypeId(string $id = null)
49
    {
50
        $this->typeId = $id;
51
        return $this;
52
    }
53
}
54