/**
  * testWmciMetricIsCalculatedForCurrentAndNotParentClass
  * 
  * @return void
  */
 public function testWmciMetricIsCalculatedForCurrentAndNotParentClass()
 {
     $namespaces = self::parseCodeResourceForTest();
     $class = $namespaces->current()->getClasses()->current();
     $ccnAnalyzer = new CyclomaticComplexityAnalyzer();
     $ccnAnalyzer->setCache(new MemoryCacheDriver());
     $analyzer = new ClassLevelAnalyzer();
     $analyzer->addAnalyzer($ccnAnalyzer);
     $analyzer->analyze($namespaces);
     $metrics = $analyzer->getNodeMetrics($class);
     $this->assertEquals(2, $metrics['wmci']);
 }
 /**
  * testAnalyzerCountsNumberOfMethodsForClassSize
  *
  * @return void
  */
 public function testAnalyzerCountsNumberOfMethodsForClassSize()
 {
     $namespaces = self::parseCodeResourceForTest();
     $class = $namespaces->current()->getClasses()->current();
     $ccnAnalyzer = new CyclomaticComplexityAnalyzer();
     $ccnAnalyzer->setCache(new MemoryCacheDriver());
     $analyzer = new ClassLevelAnalyzer();
     $analyzer->addAnalyzer($ccnAnalyzer);
     $analyzer->analyze($namespaces);
     $metrics = $analyzer->getNodeMetrics($class);
     $this->assertEquals(6, $metrics['csz']);
 }
 /**
  * testClassLevelAnalyzerNotRunsEndlessForDeepInterfaceHierarchy
  * 
  * @return void
  */
 public function testClassLevelAnalyzerNotRunsEndlessForDeepInterfaceHierarchy()
 {
     set_time_limit(5);
     $ccnAnalyzer = new CyclomaticComplexityAnalyzer();
     $ccnAnalyzer->setCache(new MemoryCacheDriver());
     $analyzer = new ClassLevelAnalyzer();
     $analyzer->addAnalyzer($ccnAnalyzer);
     $analyzer->analyze($this->parseCodeResourceForTest());
 }
 /**
  * Analyzes the source code associated with the calling test method and
  * returns all measured metrics.
  *
  * @return mixed
  * @since 1.0.6
  */
 private function _calculateTraitMetrics()
 {
     $namespaces = $this->parseCodeResourceForTest();
     $ccnAnalyzer = new CyclomaticComplexityAnalyzer();
     $ccnAnalyzer->setCache(new MemoryCacheDriver());
     $analyzer = new ClassLevelAnalyzer();
     $analyzer->addAnalyzer($ccnAnalyzer);
     $analyzer->analyze($namespaces);
     return $analyzer->getNodeMetrics($namespaces[0]->getTraits()->current());
 }