public function analyze(&$data)
 {
     if (empty($data['units'])) {
         throw new Exception(UnitAnalyzer::text() . " must be run prior to {$this}\n");
     }
     $this->initProgress(count($data['units']));
     foreach ($data['units'] as $key => $unit) {
         $this->progress();
         $data[UnitAnalyzer::$dataName][$key][CyclomaticComplexityAnalyzer::$dataName] = $this->complexity($unit);
     }
 }
Example #2
0
 public function analyze(&$data)
 {
     if (empty($data['units'])) {
         throw new Exception(UnitAnalyzer::text() . " must be run prior to {$this}\n");
     }
     $this->initProgress(count($data['units']));
     foreach ($data['units'] as &$unit) {
         $this->progress();
         $this->extractSource($unit);
     }
 }
Example #3
0
 public function analyze(&$data)
 {
     if (empty($data[UnitAnalyzer::$dataName])) {
         throw new Exception(UnitAnalyzer::text() . " must be run prior to {$this}\n");
     }
     $this->initProgress(count($data['units']));
     $this->setData($data);
     foreach ($data['units'] as $key => $unit) {
         $this->progress();
         $dep = $this->dependencies($unit);
         $data[UnitAnalyzer::$dataName][$key][DependencyAnalyzer::$dataName] = $dep[0];
         $data[UnitAnalyzer::$dataName][$key]['depsum'] = $dep[1];
     }
 }
Example #4
0
 public function analyze(&$data)
 {
     if (empty($data['xdbt'])) {
         throw new Exception('No xdebug trace file specified');
     }
     if (empty($data['units'])) {
         throw new Exception(UnitAnalyzer::text() . " must be run prior to {$this}\n");
     }
     $count = count($data['xdbt']);
     $this->initProgress($count, min(1000, $count));
     for ($i = 0; $i < $count; $i++) {
         $this->progress();
         $o = $this->analyzeXdebugTrace($data['xdbt'][$i]);
         foreach ($data['units'] as &$unit) {
             if (!isset($unit[self::$dataName])) {
                 $unit[self::$dataName] = 0;
             }
             $unit[self::$dataName] += $o["{$unit['fnc']}"];
         }
     }
     unset($data['xdbt']);
 }