*/ class PropelDataCollector extends DataCollector { protected $logger; public function __construct(PropelLogger $logger) { $this->logger = $logger; } /** * {@inheritdoc} */ public function collect(Request $request, Response $response, \Exception $exception = null) { $this->data = array( 'queries' => $this->cloneVar($this->buildQueries()), 'querycount' => $this->countQueries(), ); } /** * Returns the collector name. * * @return string The collector name. */ public function getName() { return 'propel'; } /** * Returns queries. * * @return array Queries */ public function getQueries() { return $this->data['queries']; } /** * Returns the query count. * * @return int The query count */ public function getQueryCount() { return $this->data['querycount']; } /** * Returns the total time of queries. * * @return float The total time of queries */ public function getTime() { $time = 0; foreach ($this->data['queries'] as $query) { $time += (float) $query['time']; } return $time; } /** * Creates an array of Build objects. * * @return array An array of Build objects */ private function buildQueries() { return $this->logger->getQueries(); } /** * Count queries. * * @return int The number of queries. */ private function countQueries() { return count($this->logger->getQueries()); } /** * @inheritdoc */ public function reset() { // TODO: Implement reset() method. } }