Section::getContent()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Htsl\Parser;
4
5
use Htsl\Helper\TGetter;
6
7
////////////////////////////////////////////////////////////////
8
9
/**
10
 * @property-read string      $content Content of this section.
11
 * @property-read string|null $name    Name of this section.
12
 */
13
class Section
14
{
15
	use TGetter;
16
17
	/**
18
	 * Section name.
19
	 *
20
	 * @access private
21
	 *
22
	 * @var string
23
	 */
24
	private $name;
25
26
	/**
27
	 * Content.
28
	 *
29
	 * @access private
30
	 *
31
	 * @var string
32
	 */
33
	private $content='';
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned correctly; expected 1 space but found 0 spaces

This check looks for improperly formatted assignments.

Every assignment must have exactly one space before and one space after the equals operator.

To illustrate:

$a = "a";
$ab = "ab";
$abc = "abc";

will have no issues, while

$a   = "a";
$ab  = "ab";
$abc = "abc";

will report issues in lines 1 and 2.

Loading history...
34
35
	/**
36
	 * Setting name and constructing instance of Section.
37
	 *
38
	 * @access public
39
	 *
40
	 * @param string | null $name
41
	 */
42
	public function __construct( string$name=null )
43
	{
44
		$this->name = $name;
45
	}
46
47
	/**
48
	 * Appending content to this section.
49
	 *
50
	 * @access public
51
	 *
52
	 * @param  string $content
53
	 *
54
	 * @return self
55
	 */
56
	public function append( string$content ):self
57
	{
58
		$this->content.=$content;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned correctly; expected 1 space but found 0 spaces

This check looks for improperly formatted assignments.

Every assignment must have exactly one space before and one space after the equals operator.

To illustrate:

$a = "a";
$ab = "ab";
$abc = "abc";

will have no issues, while

$a   = "a";
$ab  = "ab";
$abc = "abc";

will report issues in lines 1 and 2.

Loading history...
59
60
		return $this;
61
	}
62
63
	/**
64
	 * Getting content of this section.
65
	 *
66
	 * @access public
67
	 *
68
	 * @return string
69
	 */
70
	public function getContent():string
71
	{
72
		return $this->content;
73
	}
74
75
	/**
76
	 * Getting name of this section
77
	 *
78
	 * @access public
79
	 *
80
	 * @return string | null
81
	 */
82
	public function getName()#:string|null
83
	{
84
		return $this->name;
85
	}
86
}
0 ignored issues
show
Coding Style introduced by
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
87