/**
  * @param Build $build
  */
 public function generateBuildStatistics(Build $build)
 {
     $statistic = new Build\Statistic();
     $statistic->setName('method-coverage')->setValue($this->details['coveredMethods']);
     $build->addStatistic($statistic);
     $statistic = new Build\Statistic();
     $statistic->setName('statement-coverage')->setValue($this->details['coverageStatements']);
     $build->addStatistic($statistic);
     $statistic = new Build\Statistic();
     $statistic->setName('conditional-coverage')->setValue($this->details['coverageConditionals']);
     $build->addStatistic($statistic);
     $statistic = new Build\Statistic();
     $statistic->setName('total-coverage')->setValue($this->details['coverage']);
     $build->addStatistic($statistic);
     if ($build->getParent()) {
         if (isset($this->details['methodCoverageChange'])) {
             $statistic = new Build\Statistic();
             $statistic->setName('method-coverage-change');
             $statistic->setValue($this->details['methodCoverageChange']);
             $build->addStatistic($statistic);
         }
         if (isset($this->details['statementCoverageChange'])) {
             $statistic = new Build\Statistic();
             $statistic->setName('statement-coverage-change');
             $statistic->setValue($this->details['statementCoverageChange']);
             $build->addStatistic($statistic);
         }
         if (isset($this->details['conditionalCoverageChange'])) {
             $statistic = new Build\Statistic();
             $statistic->setName('conditional-coverage-change');
             $statistic->setValue($this->details['conditionalCoverageChange']);
             $build->addStatistic($statistic);
         }
         if (isset($this->details['totalCoverageChange'])) {
             $statistic = new Build\Statistic();
             $statistic->setName('total-coverage-change');
             $statistic->setValue($this->details['totalCoverageChange']);
             $build->addStatistic($statistic);
             $alert = new Build\Alert();
             $message = 'Code Coverage %s by ' . number_format(abs($this->details['totalCoverageChange']), 2) . '%%';
             if ($this->details['totalCoverageChange'] < 0) {
                 $alert->setType('warning');
                 $alert->setDescription(sprintf($message, 'Decreased'));
             } elseif ($this->details['totalCoverageChange'] > 0) {
                 $alert->setType('success');
                 $alert->setDescription(sprintf($message, 'Increased'));
             } else {
                 $alert->setType('info');
                 $alert->setDescription('Code Coverage Remained the Same');
             }
             $build->addAlert($alert);
         }
     }
 }