Completed
Push — master ( 28517b...4142e2 )
by Mike
13s queued 11s
created

ClassString   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 33
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getFqsen() 0 4 1
A __toString() 0 8 2
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * This file is part of phpDocumentor.
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 *
11
 * @link      http://phpdoc.org
12
 */
13
14
namespace phpDocumentor\Reflection\Types;
15
16
use phpDocumentor\Reflection\Fqsen;
17
use phpDocumentor\Reflection\Type;
18
19
/**
20
 * Value Object representing the type 'string'.
21
 */
22
final class ClassString implements Type
23
{
24
    /** @var Fqsen|null */
25
    private $fqsen;
26
27
    /**
28
     * Initializes this representation of a class string with the given Fqsen.
29
     */
30
    public function __construct(?Fqsen $fqsen = null)
31
    {
32
        $this->fqsen = $fqsen;
33
    }
34
35
    /**
36
     * Returns the FQSEN associated with this object.
37
     */
38
    public function getFqsen() : ?Fqsen
39
    {
40
        return $this->fqsen;
41
    }
42
43
    /**
44
     * Returns a rendered output of the Type as it would be used in a DocBlock.
45
     */
46
    public function __toString() : string
47
    {
48
        if ($this->fqsen === null) {
49
            return 'class-string';
50
        } else {
51
            return 'class-string<' . (string)$this->fqsen . '>';
52
        }
53
    }
54
}
55