WorkplaceMessage   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 0

Test Coverage

Coverage 83.33%

Importance

Changes 0
Metric Value
wmc 7
lcom 2
cbo 0
dl 0
loc 54
ccs 15
cts 18
cp 0.8333
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getContent() 0 4 1
A content() 0 6 1
A isMarkdown() 0 4 1
A isPlainText() 0 4 1
A asMarkdown() 0 6 1
A asPlainText() 0 6 1
1
<?php
2
3
namespace NotificationChannels\Workplace;
4
5
class WorkplaceMessage
6
{
7
    /** @var string The message content */
8
    protected $content;
9
10
    /** @var bool Flag content as markdown */
11
    protected $markdown = true;
12
13
    /**
14
     * Message constructor.
15
     *
16
     * @param string $content
17
     */
18 6
    public function __construct($content = '')
19
    {
20 6
        $this->content = $content;
21 6
    }
22
23 4
    public function getContent()
24
    {
25 4
        return $this->content;
26
    }
27
28 1
    public function content($content)
29
    {
30 1
        $this->content = $content;
31
32 1
        return $this;
33
    }
34
35 4
    public function isMarkdown()
36
    {
37 4
        return $this->markdown;
38
    }
39
40 1
    public function isPlainText()
41
    {
42 1
        return ! $this->markdown;
43
    }
44
45
    public function asMarkdown()
46
    {
47
        $this->markdown = true;
48
49
        return $this;
50
    }
51
52 1
    public function asPlainText()
53
    {
54 1
        $this->markdown = false;
55
56 1
        return $this;
57
    }
58
}
59