当前位置: 首页>>代码示例>>PHP>>正文


PHP PHP_PMD_AbstractNode::getMetric方法代码示例

本文整理汇总了PHP中PHP_PMD_AbstractNode::getMetric方法的典型用法代码示例。如果您正苦于以下问题:PHP PHP_PMD_AbstractNode::getMetric方法的具体用法?PHP PHP_PMD_AbstractNode::getMetric怎么用?PHP PHP_PMD_AbstractNode::getMetric使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHP_PMD_AbstractNode的用法示例。


在下文中一共展示了PHP_PMD_AbstractNode::getMetric方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: apply

 /**
  * This method checks the length of the given class node against a configured
  * threshold.
  *
  * @param PHP_PMD_AbstractNode $node The context source code node.
  *
  * @return void
  */
 public function apply(PHP_PMD_AbstractNode $node)
 {
     $threshold = $this->getIntProperty('minimum');
     $ignoreWhitespace = $this->getBooleanProperty('ignore-whitespace');
     if ($ignoreWhitespace) {
         $loc = $node->getMetric('eloc');
     } else {
         $loc = $node->getMetric('loc');
     }
     if ($loc < $threshold) {
         return;
     }
     $this->addViolation($node, array($node->getName(), $loc, $threshold));
 }
开发者ID:n2bh,项目名称:phpmd,代码行数:22,代码来源:LongClass.php

示例2: apply

 /**
  * This method checks the number of public fields and methods in the given
  * class and checks that value against a configured threshold.
  *
  * @param PHP_PMD_AbstractNode $node The context source code node.
  *
  * @return void
  */
 public function apply(PHP_PMD_AbstractNode $node)
 {
     if ($node->getMetric('cis') < $this->getIntProperty('minimum')) {
         return;
     }
     $this->addViolation($node);
 }
开发者ID:noelg,项目名称:phpmd,代码行数:15,代码来源:ExcessivePublicCount.php

示例3: apply

 /**
  * This method checks the number of classes derived from the given class
  * node.
  *
  * @param PHP_PMD_AbstractNode $node The context source code node.
  *
  * @return void
  */
 public function apply(PHP_PMD_AbstractNode $node)
 {
     $nocc = $node->getMetric('nocc');
     if ($nocc >= $this->getIntProperty('minimum')) {
         $this->addViolation($node, array($node->getName(), $nocc));
     }
 }
开发者ID:yusufchang,项目名称:app,代码行数:15,代码来源:NumberOfChildren.php

示例4: apply

 /**
  * This method checks the number of methods with in a given class and checks
  * this number against a configured threshold.
  *
  * @param PHP_PMD_AbstractNode $node The context source code node.
  *
  * @return void
  */
 public function apply(PHP_PMD_AbstractNode $node)
 {
     if ($node->getMetric('vars') <= $this->getIntProperty('maxfields')) {
         return;
     }
     $this->addViolation($node);
 }
开发者ID:kingsj,项目名称:core,代码行数:15,代码来源:TooManyFields.php

示例5: apply

 /**
  * This method should implement the violation analysis algorithm of concrete
  * rule implementations. All extending classes must implement this method.
  *
  * @param PHP_PMD_AbstractNode $node The current context for analysis.
  *
  * @return void
  */
 public function apply(PHP_PMD_AbstractNode $node)
 {
     $cbo = $node->getMetric('cbo');
     if ($cbo >= ($threshold = $this->getIntProperty('minimum'))) {
         $this->addViolation($node, array($node->getName(), $cbo, $threshold));
     }
 }
开发者ID:syntropysoftware,项目名称:cryptoffice-frontend,代码行数:15,代码来源:CouplingBetweenObjects.php

示例6: apply

 /**
  * This method checks the length of the given class node against a configured
  * threshold.
  *
  * @param PHP_PMD_AbstractNode $node The context source code node.
  *
  * @return void
  */
 public function apply(PHP_PMD_AbstractNode $node)
 {
     $loc = $node->getMetric('loc');
     if ($loc < $this->getIntProperty('minimum')) {
         return;
     }
     $this->addViolation($node, array($node->getName(), $loc));
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:16,代码来源:LongClass.php

示例7: apply

 /**
  * This method checks the acyclic complexity for the given node against a
  * configured threshold.
  *
  * @param PHP_PMD_AbstractNode $node The context source code node.
  *
  * @return void
  */
 public function apply(PHP_PMD_AbstractNode $node)
 {
     $npath = $node->getMetric('npath');
     if ($npath < $this->getIntProperty('minimum')) {
         return;
     }
     $this->addViolation($node, array($node->getType(), $node->getName(), $npath));
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:16,代码来源:NpathComplexity.php

示例8: apply

 /**
  * This method checks the number of parents for the given class
  * node.
  *
  * @param PHP_PMD_AbstractNode $node The context source code node.
  *
  * @return void
  */
 public function apply(PHP_PMD_AbstractNode $node)
 {
     $threshold = $this->getIntProperty('minimum');
     $dit = $node->getMetric('dit');
     if ($dit >= $threshold) {
         $this->addViolation($node, array($node->getType(), $node->getName(), $dit, $threshold));
     }
 }
开发者ID:syntropysoftware,项目名称:cryptoffice-frontend,代码行数:16,代码来源:DepthOfInheritance.php

示例9: apply

 /**
  * This method checks the cyclomatic complexity for the given node against
  * a configured threshold.
  *
  * @param PHP_PMD_AbstractNode $node The context source code node.
  *
  * @return void
  */
 public function apply(PHP_PMD_AbstractNode $node)
 {
     $ccn = $node->getMetric('ccn2');
     if ($ccn < $this->getIntProperty('reportLevel')) {
         return;
     }
     $this->addViolation($node, array($node->getType(), $node->getName(), $ccn));
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:16,代码来源:CyclomaticComplexity.php

示例10: apply

 /**
  * This method checks the weighted method count for the given class against
  * a configured threshold.
  *
  * @param PHP_PMD_AbstractNode $node The context class node.
  *
  * @return void
  */
 public function apply(PHP_PMD_AbstractNode $node)
 {
     $threshold = $this->getIntProperty('maximum');
     $actual = $node->getMetric('wmc');
     if ($actual >= $threshold) {
         $this->addViolation($node, array($node->getName(), $actual, $threshold));
     }
 }
开发者ID:kingsj,项目名称:core,代码行数:16,代码来源:WeightedMethodCount.php

示例11: apply

 /**
  * This method checks the number of public fields and methods in the given
  * class and checks that value against a configured threshold.
  *
  * @param PHP_PMD_AbstractNode $node The context source code node.
  *
  * @return void
  */
 public function apply(PHP_PMD_AbstractNode $node)
 {
     $threshold = $this->getIntProperty('minimum');
     $cis = $node->getMetric('cis');
     if ($cis < $threshold) {
         return;
     }
     $this->addViolation($node, array($node->getType(), $node->getName(), $cis, $threshold));
 }
开发者ID:syntropysoftware,项目名称:cryptoffice-frontend,代码行数:17,代码来源:ExcessivePublicCount.php

示例12: apply

 /**
  * This method checks the number of methods with in a given class and checks
  * this number against a configured threshold.
  *
  * @param PHP_PMD_AbstractNode $node The context source code node.
  *
  * @return void
  */
 public function apply(PHP_PMD_AbstractNode $node)
 {
     $threshold = $this->getIntProperty('maxfields');
     $vars = $node->getMetric('vars');
     if ($vars <= $threshold) {
         return;
     }
     $this->addViolation($node, array($node->getType(), $node->getName(), $vars, $threshold));
 }
开发者ID:syntropysoftware,项目名称:cryptoffice-frontend,代码行数:17,代码来源:TooManyFields.php

示例13: apply

 /**
  * This method checks the number of methods with in a given class and checks
  * this number against a configured threshold.
  *
  * @param PHP_PMD_AbstractNode $node The context source code node.
  *
  * @return void
  */
 public function apply(PHP_PMD_AbstractNode $node)
 {
     if ($node->getMetric('nom') <= $this->getIntProperty('maxmethods')) {
         return;
     }
     if ($this->_countMethods($node) <= $this->getIntProperty('maxmethods')) {
         return;
     }
     $this->addViolation($node);
 }
开发者ID:kingsj,项目名称:core,代码行数:18,代码来源:TooManyMethods.php

示例14: apply

 /**
  * This method checks the lines of code length for the given function or
  * methode node against a configured threshold.
  *
  * @param PHP_PMD_AbstractNode $node The context source code node.
  *
  * @return void
  */
 public function apply(PHP_PMD_AbstractNode $node)
 {
     $loc = $node->getMetric('loc');
     if ($loc < $this->getIntProperty('minimum')) {
         return;
     }
     $type = explode('_', get_class($node));
     $type = strtolower(array_pop($type));
     $this->addViolation($node, array($type, $node->getName(), $loc));
 }
开发者ID:kingsj,项目名称:core,代码行数:18,代码来源:LongMethod.php

示例15: apply

 /**
  * This method checks the number of methods with in a given class and checks
  * this number against a configured threshold.
  *
  * @param PHP_PMD_AbstractNode $node The context source code node.
  *
  * @return void
  */
 public function apply(PHP_PMD_AbstractNode $node)
 {
     $threshold = $this->getIntProperty('maxmethods');
     if ($node->getMetric('nom') <= $threshold) {
         return;
     }
     $nom = $this->_countMethods($node);
     if ($nom <= $threshold) {
         return;
     }
     $this->addViolation($node, array($node->getType(), $node->getName(), $nom, $threshold));
 }
开发者ID:zerkalica,项目名称:phpmd,代码行数:20,代码来源:TooManyMethods.php


注:本文中的PHP_PMD_AbstractNode::getMetric方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。