PhpTrait::toString()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
1
<?php
2
3
namespace Swaggest\PhpCodeBuilder;
4
5
use Swaggest\PhpCodeBuilder\Traits\Description;
6
7
class PhpTrait extends PhpTemplate
8
{
9
    use Description;
10
11
    /** @var string  */
12
    protected $name;
13
14
    /**
15
     * PhpTrait constructor.
16
     * @param string $name
17
     */
18
    public function __construct($name)
19
    {
20
        $this->name = $name;
21
    }
22
23
    /**
24
     * @return string
25
     */
26
    public function getName()
27
    {
28
        return $this->name;
29
    }
30
31
    protected function toString()
32
    {
33
        return <<<PHP
34
{$this->renderDescriptionAsPhpDoc()}use {$this->name};
35
36
37
PHP;
38
    }
39
}