Comment   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 20
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A format() 0 4 1
A removeLineBreaks() 0 4 1
1
<?php
2
3
namespace MyBuilder\Cronos\Formatter;
4
5
class Comment
6
{
7
    /** @var string */
8
    private $comment;
9
10
    public function __construct(string $comment)
11
    {
12
        $this->comment = $comment;
13
    }
14
15
    public function format(): string
16
    {
17
        return '#' . $this->removeLineBreaks($this->comment);
18
    }
19
20
    private function removeLineBreaks($text): string
21
    {
22
        return \str_replace(["\r", "\r\n", "\n", \PHP_EOL], '', $text);
23
    }
24
}
25