PHPDoc   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A writeInheritdoc() 0 8 1
A writeProperty() 0 9 1
A makeComment() 0 4 2
1
<?php
2
3
/**
4
 * Spiral Framework. Cycle ProxyFactory
5
 *
6
 * @license MIT
7
 * @author  Valentin V (Vvval)
8
 */
9
10
declare(strict_types=1);
11
12
namespace Cycle\ORM\Promise;
13
14
use PhpParser\Comment\Doc;
15
16
final class PHPDoc
17
{
18
    /**
19
     * @return Doc
20
     */
21
    public static function writeInheritdoc(): Doc
22
    {
23
        return self::makeComment([
24
            '/**',
25
            ' * {@inheritdoc}',
26
            ' */'
27
        ]);
28
    }
29
30
    /**
31
     * @param string $type
32
     * @return Doc
33
     */
34
    public static function writeProperty(string $type): Doc
35
    {
36
        return self::makeComment([
37
            '/**',
38
            ' * @internal',
39
            " * @var $type",
40
            ' */'
41
        ]);
42
    }
43
44
    /**
45
     * @param array|string $comment
46
     * @return Doc
47
     */
48
    private static function makeComment($comment): Doc
49
    {
50
        return new Doc(is_array($comment) ? implode("\n", $comment) : $comment);
51
    }
52
}
53