BaseWidget   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 18
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A htmlAttribsToString() 0 15 2
1
<?php
2
/**
3
 * This file is part of the Disqus Helper package.
4
 *
5
 * Copyright (c) Nikola Posa <[email protected]>
6
 *
7
 * For full copyright and license information, please refer to the LICENSE file,
8
 * located at the package root folder.
9
 */
10
11
declare(strict_types=1);
12
13
namespace DisqusHelper\Widget;
14
15
/**
16
 * @author Nikola Posa <[email protected]>
17
 */
18
abstract class BaseWidget implements WidgetInterface
19
{
20 4
    protected function htmlAttribsToString(array $attribs) : string
21
    {
22 4
        $html = '';
23
24 4
        foreach ($attribs as $key => $val) {
25 4
            $key = htmlspecialchars($key, ENT_QUOTES);
26 4
            $val = htmlspecialchars($val, ENT_QUOTES);
27
28 4
            $html .= "$key=\"$val\" ";
29
        }
30
31 4
        $html = rtrim($html);
32
33 4
        return $html;
34
    }
35
}
36