/** * Adds an analyzer to log. If this logger accepts the given analyzer it * with return <b>true</b>, otherwise the return value is <b>false</b>. * * @param PHP_Depend_Metrics_AnalyzerI $analyzer The analyzer to log. * * @return boolean */ public function log(PHP_Depend_Metrics_AnalyzerI $analyzer) { $accept = false; if ($analyzer instanceof PHP_Depend_Metrics_ProjectAwareI) { // Get project metrics $metrics = $analyzer->getProjectMetrics(); // Merge with existing metrics. $this->projectMetrics = array_merge($this->projectMetrics, $metrics); $accept = true; } if ($analyzer instanceof PHP_Depend_Metrics_NodeAwareI) { $this->_nodeAwareAnalyzers[] = $analyzer; $accept = true; } return $accept; }
/** * Initializes the given analyzer instance. * * @param PHP_Depend_Metrics_AnalyzerI $analyzer Context analyzer instance. * * @return PHP_Depend_Metrics_AnalyzerI * @since 0.9.10 */ private function _configure(PHP_Depend_Metrics_AnalyzerI $analyzer) { if (!$analyzer instanceof PHP_Depend_Metrics_AggregateAnalyzerI) { return $analyzer; } $required = $this->_loadAcceptedAnalyzers($analyzer->getRequiredAnalyzers()); foreach ($required as $requiredAnalyzer) { $analyzer->addAnalyzer($requiredAnalyzer); } return $analyzer; }