/**
  * @dataProvider provideAbstractness
  */
 public function testICanKnowTheAbstractnessOfPackage($expected, $abstractClasses, $concreteClasses)
 {
     $instability = new Abstractness();
     $results = new ResultCollection();
     $oop = $this->getMockBuilder('\\Hal\\Component\\OOP\\Extractor\\Result')->disableOriginalConstructor()->getMock();
     $oop->expects($this->any())->method('getConcreteClasses')->will($this->returnValue(array_pad(array(), $concreteClasses, null)));
     $oop->expects($this->any())->method('getAbstractClasses')->will($this->returnValue(array_pad(array(), $abstractClasses, null)));
     $resultSet = $this->getMockBuilder('\\Hal\\Component\\Result\\ResultSet')->disableOriginalConstructor()->getMock();
     $resultSet->expects($this->any())->method('getOOP')->will($this->returnValue($oop));
     $results->push($resultSet);
     $r = $instability->calculate($results);
     $this->assertEquals($expected, $r->getAbstractness());
 }
 /**
  * @inheritdoc
  */
 public function execute(ResultCollection $collection, ResultCollection $aggregatedResults)
 {
     $this->output->write(str_pad("\rGrouping results by package/directory. This will take few minutes...", 80, " "));
     // Aggregates results
     $groupedResults = $this->aggregator->aggregates($collection);
     // metrics tools
     $abstractness = new Abstractness();
     $bounds = new Bounds();
     $instability = new Instability();
     foreach ($groupedResults as $namespace => $results) {
         // we filter aggregates to conserve only direct results
         $childs = new ResultCollection();
         foreach ($results as $r) {
             if ($namespace === dirname($r->getName())) {
                 $childs->push($r);
             }
         }
         $resultAggregate = new ResultAggregate($namespace);
         $resultAggregate->setAbstractness($abstractness->calculate($results))->setInstability($instability->calculate($results))->setBounds($bounds->calculate($results))->setChilds($childs);
         $aggregatedResults->push($resultAggregate);
     }
 }