Passed
Pull Request — master (#19)
by
unknown
02:19
created

MethodDocSniff::process()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 20
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 11
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 20
ccs 11
cts 11
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 12
nc 2
nop 2
crap 2
1
<?php
2
3
namespace BestIt\Sniffs\Commenting;
4
5
/**
6
 * Class MethodDocSniff
7
 *
8
 * @package BestIt\Sniffs\Commenting
9
 * @author Nick Lubisch <[email protected]>
10
 */
11
class MethodDocSniff extends AbstractDocSniff
12
{
13
    /**
14
     * Returns which tokens should be listened to.
15
     *
16
     * @return int[] List of tokens which is to be listened to
17
     */
18 28
    public function getListenedTokens()
19
    {
20
        return [
21 28
            T_FUNCTION
22
        ];
23
    }
24
25
    /**
26
     * Returns allowed tag metadata.
27
     *
28
     * @return array List of tag metadata
29
     */
30 26
    public function getTagMetadata()
31
    {
32
        return [
33
            '@param' => [
34
                'min' => 0,
35
                'max' => null,
36
                'lineAfter' => true
37 26
            ],
38
            '@return' => [
39 26
                'min' => 1,
40 26
                'max' => 1,
41 26
                'if' => [$this->getTagHelper(), 'isNoWhitelistedFunction'],
42
                'lineAfter' => true
43
            ],
44
            '@throws' => [
45
                'min' => 0,
46
                'max' => null
47
            ],
48
            '@deprecated' => [
49
                'min' => 0,
50
                'max' => 1
51
            ],
52
            '@link' => [
53
                'min' => 0,
54
                'max' => null
55
            ]
56
        ];
57
    }
58
59
    /**
60
     * Returns an array of disallowed tokens.
61
     *
62
     * @return array List of disallowed tags
63
     */
64 26 View Code Duplication
    public function getDisallowedTags()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
65
    {
66
        return [
67 26
            '@api',
68
            '@author',
69
            '@category',
70
            '@copyright',
71
            '@filesource',
72
            '@global',
73
            '@ignore',
74
            '@internal',
75
            '@license',
76
            '@link',
77
            '@method',
78
            '@package',
79
            '@property',
80
            '@property-read',
81
            '@property-write',
82
            '@see',
83
            '@since',
84
            '@source',
85
            '@subpackage',
86
            '@todo',
87
            '@uses',
88
            '@var',
89
            '@version',
90
            '@inheritdoc'
91
        ];
92
    }
93
}
94