Code Duplication    Length = 23-23 lines in 2 locations

src/main/php/PHPMD/Rule/Design/TooManyMethods.php 1 location

@@ 44-66 (lines=23) @@
41
     * @param \PHPMD\AbstractNode $node
42
     * @return void
43
     */
44
    public function apply(AbstractNode $node)
45
    {
46
        $this->ignoreRegexp = $this->getStringProperty('ignorepattern');
47
48
        $threshold = $this->getIntProperty('maxmethods');
49
        if ($node->getMetric('nom') <= $threshold) {
50
            return;
51
        }
52
        /** @var $node AbstractTypeNode */
53
        $nom = $this->countMethods($node);
54
        if ($nom <= $threshold) {
55
            return;
56
        }
57
        $this->addViolation(
58
            $node,
59
            array(
60
                $node->getType(),
61
                $node->getName(),
62
                $nom,
63
                $threshold
64
            )
65
        );
66
    }
67
68
    /**
69
     * Counts all methods within the given class/interface node.

src/main/php/PHPMD/Rule/Design/TooManyPublicMethods.php 1 location

@@ 44-66 (lines=23) @@
41
     * @param \PHPMD\AbstractNode $node
42
     * @return void
43
     */
44
    public function apply(AbstractNode $node)
45
    {
46
        $this->ignoreRegexp = $this->getStringProperty('ignorepattern');
47
48
        $threshold = $this->getIntProperty('maxmethods');
49
        if ($node->getMetric('npm') <= $threshold) {
50
            return;
51
        }
52
        /** @var $node AbstractTypeNode */
53
        $nom = $this->countMethods($node);
54
        if ($nom <= $threshold) {
55
            return;
56
        }
57
        $this->addViolation(
58
            $node,
59
            array(
60
                $node->getType(),
61
                $node->getName(),
62
                $nom,
63
                $threshold
64
            )
65
        );
66
    }
67
68
    /**
69
     * Counts public methods within the given class/interface node.