PhpDocTag   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 16
dl 0
loc 30
ccs 10
cts 10
cp 1
rs 10
c 2
b 0
f 0
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A toString() 0 13 3
A __construct() 0 4 1
1
<?php
2
3
namespace Swaggest\PhpCodeBuilder;
4
5
class PhpDocTag extends PhpTemplate
6
{
7
8
    public $name;
9
    public $value;
10
11
    /**
12
     * PhpDocTag constructor.
13
     * @param string $name
14
     * @param string $value
15
     */
16 13
    public function __construct($name, $value = '')
17
    {
18 13
        $this->name = $name;
19 13
        $this->value = $value;
20 13
    }
21
22 12
    protected function toString()
23
    {
24 12
        $value = trim($this->value);
25 12
        $value = $value ? ' ' . $value : '';
26 12
        if (strpos($value, "\n") !== false) {
27
            return <<<PHP
28
/**
29 2
 * @{$this->name}{$this->padLines(' * ', $value)}
30
 */
31
PHP;
32
        } else {
33
            return <<<PHP
34 12
/** @{$this->name}{$value} */
35
PHP;
36
        }
37
38
    }
39
}