Completed
Push — master ( d67b8f...d63c9e )
by Thomas
02:04
created

TypePart::getNullable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
declare(strict_types=1);
3
4
namespace gossi\codegen\model\parts;
5
6
/**
7
 * Type part
8
 *
9
 * For all models that have a type
10
 *
11
 * @author Thomas Gossmmann
12
 */
13
trait TypePart {
14
15
	/** @var string */
16
	private $type;
17
18
	/** @var string */
19
	private $typeDescription;
20
	
21
	/** @var bool */
22
	private $typeNullable;
23
24
	/**
25
	 * Sets the type
26
	 *
27
	 * @param string $type
28
	 * @param string $description
29
	 * @return $this
30
	 */
31 22
	public function setType(?string $type, string $description = null) {
32 22
		$this->type = $type;
33 22
		if (null !== $description) {
34 11
			$this->setTypeDescription($description);
35
		}
36
37 22
		return $this;
38
	}
39
40
	/**
41
	 * Sets the description for the type
42
	 *
43
	 * @param string $description
44
	 * @return $this
45
	 */
46 10
	public function setTypeDescription(string $description) {
47 10
		$this->typeDescription = $description;
48 10
		return $this;
49
	}
50
51
	/**
52
	 * Returns the type
53
	 *
54
	 * @return string
55
	 */
56 41
	public function getType(): ?string {
57 41
		return $this->type;
58
	}
59
60
	/**
61
	 * Returns the type description
62
	 *
63
	 * @return string
64
	 */
65 10
	public function getTypeDescription(): ?string {
66 10
		return $this->typeDescription;
67
	}
68
	
69
	/**
70
	 * Returns whether the type is nullable
71
	 * 
72
	 * @return bool
73
	 */
74 2
	public function getNullable(): bool {
75 2
        return $this->typeNullable;
76
	}
77
	
78
	/**
79
	 * Sets the type nullable
80
	 * 
81
	 * @param bool $nullable
82
	 * @return $this
83
	 */
84 2
	public function setNullable(bool $nullable) {
85 2
	    $this->typeNullable = $nullable;
86 2
	    return $this;
87
	}
88
}
89