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

TypeIdAttributeTrait   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 39
ccs 0
cts 16
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getTypeId() 0 7 2
A findTypeId() 0 4 1
A setTypeId() 0 5 1
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