Arbit - project tracking

PHPMD

History

Diff

202 203 /source/PHP/PMD/Node/Class.php
72 72 {
73 73 parent::__construct($node);
74 74 }
75 -
76 - /**
77 - * This method will return the metric value for the given identifier or
78 - * <b>null</b> when no such metric exists.
79 - *
80 - * @param string $name The metric name or abbreviation.
81 - *
82 - * @return mixed
83 - */
84 - public function getMetric($name)
85 - {
86 - if ($name === 'nopm') {
87 - return $this->_numberOfPublicMembers();
88 - }
89 - return parent::getMetric($name);
90 - }
91 -
92 - /**
93 - * Returns the number of public fields and/or methods in the context class.
94 - *
95 - * @return integer
96 - */
97 - private function _numberOfPublicMembers()
98 - {
99 - $numberOfPublicMembers = 0;
100 - foreach ($this->getNode()->getMethods() as $method) {
101 - if ($method->isPublic()) {
102 - ++$numberOfPublicMembers;
103 - }
104 - }
105 - foreach ($this->getNode()->getProperties() as $property) {
106 - if ($property->isPublic()) {
107 - ++$numberOfPublicMembers;
108 - }
109 - }
110 - return $numberOfPublicMembers;
111 - }
112 75 }