RuleStub::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 8
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * This file is part of PHP Mess Detector.
4
 *
5
 * Copyright (c) Manuel Pichler <[email protected]>.
6
 * All rights reserved.
7
 *
8
 * Licensed under BSD License
9
 * For full copyright and license information, please see the LICENSE file.
10
 * Redistributions of files must retain the above copyright notice.
11
 *
12
 * @author Manuel Pichler <[email protected]>
13
 * @copyright Manuel Pichler. All rights reserved.
14
 * @license https://opensource.org/licenses/bsd-license.php BSD License
15
 * @link http://phpmd.org/
16
 */
17
18
namespace PHPMD\Stubs;
19
20
use PHPMD\AbstractNode;
21
use PHPMD\AbstractRule;
22
use PHPMD\Rule\ClassAware;
23
24
/**
25
 * Simple rule stub implementation
26
 */
27
class RuleStub extends AbstractRule implements ClassAware
28
{
29
    public $node = null;
30
31
    /**
32
     * Constructs a new rule stub instance.
33
     *
34
     * @param string $ruleName    The rule name.
35
     * @param string $ruleSetName The rule-set name.
36
     */
37
    public function __construct($ruleName = 'RuleStub', $ruleSetName = 'TestRuleSet')
38
    {
39
        $this->setName($ruleName);
40
        $this->setExternalInfoUrl('https://phpmd.org/rules/index.html');
41
        $this->setRuleSetName($ruleSetName);
42
        $this->setSince('42.23');
43
        $this->setDescription('Simple rule stub');
44
    }
45
46
    /**
47
     * This method should implement the violation analysis algorithm of concrete
48
     * rule implementations. All extending classes must implement this method.
49
     *
50
     * @param \PHPMD\AbstractNode $node
51
     * @return void
52
     */
53
    public function apply(AbstractNode $node)
54
    {
55
        $this->node = $node;
56
    }
57
}
58