Completed
Pull Request — master (#68)
by Cristiano
05:36
created

DocblockPart   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 1
cbo 1
dl 0
loc 31
ccs 8
cts 8
cp 1
rs 10
1
<?php declare(strict_types=1);
2
/*
3
 * This file is part of the php-code-generator package.
4
 * For the full copyright and license information, please view the LICENSE
5
 * file that was distributed with this source code.
6
 *
7
 * @license Apache-2.0
8
 */
9
10
namespace gossi\codegen\model\parts;
11
12
use gossi\docblock\Docblock;
13
14
/**
15
 * Docblock Part
16
 *
17
 * Setting and getting a docblock on a model
18
 *
19
 * @author Thomas Gossmann
20
 */
21
trait DocblockPart {
22
23
	/** @var Docblock */
24
	private Docblock $docblock;
0 ignored issues
show
Bug introduced by
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_STRING, expecting T_FUNCTION or T_CONST
Loading history...
25
26 8
	/**
27 8
	 * Sets the docblock
28 6
	 *
29 6
	 * @param Docblock|string $doc
30
	 *
31 8
	 * @return $this
32
	 */
33 8
	public function setDocblock(string|Docblock $doc): self {
34
		if (is_string($doc)) {
35
			$doc = new Docblock(trim($doc));
36
		}
37
		$this->docblock = $doc;
38
39
		return $this;
40
	}
41 60
42 60
	/**
43
	 * Returns the docblock
44
	 *
45
	 * @return Docblock
46
	 */
47
	public function getDocblock(): Docblock {
48
		return $this->docblock;
49
	}
50
}
51