Пример #1
0
 public function put(DataContainer $request)
 {
     if (!is_dir($this->path)) {
         mkdir($this->path);
     }
     file_put_contents($this->path . '/' . $request->getUniqueId() . $this->extension, serialize($request));
 }
Пример #2
0
 public function onCloseHeaders(Request $request, Response $response)
 {
     try {
         $this->app['stopwatch']->stop('Framework running.');
     } catch (\LogicException $e) {
         //no problem here, this event might not be started
     }
     //Generate data anyway
     $this->collectors->generateData();
     $this->collectors->saveData();
     $time = '';
     $time_collector = $this->collectors->getData();
     if (array_key_exists('time', $time_collector)) {
         $time = Utils::getReadableTime($time_collector['time']['totalTime'] * 1000);
     }
     $response->headers->add(array('X-Profile-env' => $this->app->environment(), 'X-Profile-time' => $time));
 }