FormatterHelper   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 19
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A formatSections() 0 12 2
1
<?php
2
3
namespace Glooby\Debug\Formatter;
4
5
/**
6
 * @author Emil Kilhage
7
 */
8
class FormatterHelper
9
{
10
    /**
11
     * @param array $sections
12
     * @return string
13
     */
14
    public static function formatSections(array $sections)
15
    {
16
        $sectionsFormatted = [];
17
18
        foreach ($sections as $k => $v) {
19
            $sectionsFormatted[] = sprintf("%s\n%s\n%s", $k, str_repeat('-', strlen($k)), trim($v));
20
        }
21
22
        $text = implode("\n\n", $sectionsFormatted) . "\n";
23
24
        return $text;
25
    }
26
}
27