當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PHP_PMD_AbstractNode類代碼示例

本文整理匯總了PHP中PHP_PMD_AbstractNode的典型用法代碼示例。如果您正苦於以下問題:PHP PHP_PMD_AbstractNode類的具體用法?PHP PHP_PMD_AbstractNode怎麽用?PHP PHP_PMD_AbstractNode使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了PHP_PMD_AbstractNode類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: 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

示例2: 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

示例3: checkNodeImage

 /**
  * {@inheritdoc}
  */
 protected function checkNodeImage(PHP_PMD_AbstractNode $node)
 {
     $excludedVariables = explode('|', $this->getStringProperty('excludeVariables'));
     if (!in_array($node->getImage(), $excludedVariables)) {
         parent::checkNodeImage($node);
     }
 }
開發者ID:alexisfroger,項目名稱:pim-community-dev,代碼行數:10,代碼來源:ShortVariableWithExclusion.php

示例4: apply

 /**
  * Extracts all variable and variable declarator nodes from the given node
  * and checks the variable name length against the configured minimum
  * length.
  *
  * @param PHP_PMD_AbstractNode $node The context source code node.
  *
  * @return void
  */
 public function apply(PHP_PMD_AbstractNode $node)
 {
     if ($this->getIntProperty('minimum') <= strlen($node->getName())) {
         return;
     }
     $this->addViolation($node, array($node->getParentName(), $node->getName()));
 }
開發者ID:kingsj,項目名稱:core,代碼行數:16,代碼來源:ShortMethodName.php

示例5: 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

示例6: 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

示例7: apply

 /**
  * Extracts all variable and variable declarator nodes from the given node
  * and checks the variable name length against the configured minimum
  * length.
  *
  * @param PHP_PMD_AbstractNode $node The context source code node.
  *
  * @return void
  */
 public function apply(PHP_PMD_AbstractNode $node)
 {
     if (strcasecmp($node->getName(), $node->getParentName()) !== 0) {
         return;
     }
     $this->addViolation($node);
 }
開發者ID:Tjorriemorrie,項目名稱:app,代碼行數:16,代碼來源:ConstructorWithNameAsEnclosingClass.php

示例8: apply

 /**
  * This method checks the number of arguments for the given function or method
  * node 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->getParameterCount() < $this->getIntProperty('minimum')) {
         return;
     }
     $this->addViolation($node);
 }
開發者ID:yusufchang,項目名稱:app,代碼行數:15,代碼來源:LongParameterList.php

示例9: apply

 /**
  * This method checks if a superglobal is used
  * and emits a rule violation.
  *
  * @param PHP_PMD_AbstractNode $node The context source code node.
  *
  * @return void
  */
 public function apply(PHP_PMD_AbstractNode $node)
 {
     foreach ($node->findChildrenOfType('Variable') as $variable) {
         if (in_array($variable->getImage(), $this->superglobals)) {
             $this->addViolation($node, array($node->getName(), $variable->getImage()));
         }
     }
 }
開發者ID:syntropysoftware,項目名稱:cryptoffice-frontend,代碼行數:16,代碼來源:Superglobals.php

示例10: apply

 /**
  * This method checks if a variable is not named in camelCase
  * and emits a rule violation.
  *
  * @param PHP_PMD_AbstractNode $node The context source code node.
  *
  * @return void
  */
 public function apply(PHP_PMD_AbstractNode $node)
 {
     foreach ($node->findChildrenOfType('Variable') as $variable) {
         if (!preg_match('/^\\$[a-z][a-zA-Z0-9]*$/', $variable->getImage())) {
             $this->addViolation($node, array($variable->getImage()));
         }
     }
 }
開發者ID:syntropysoftware,項目名稱:cryptoffice-frontend,代碼行數:16,代碼來源:CamelCaseVariableName.php

示例11: 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

示例12: 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

示例13: 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

示例14: 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

示例15: apply

 /**
  * This method checks if a method is not named in camelCase
  * and emits a rule violation.
  *
  * @param PHP_PMD_AbstractNode $node The context source code node.
  *
  * @return void
  */
 public function apply(PHP_PMD_AbstractNode $node)
 {
     if (!in_array($node->getName(), $this->ignoredMethods)) {
         if (!preg_match('/^[a-z][a-zA-Z0-9]*$/', $node->getName())) {
             $this->addViolation($node, array($node->getName()));
         }
     }
 }
開發者ID:syntropysoftware,項目名稱:cryptoffice-frontend,代碼行數:16,代碼來源:CamelCaseMethodName.php


注:本文中的PHP_PMD_AbstractNode類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。