/**
  * @inherit
  */
 public function handle()
 {
     $formatter = new Formatter();
     $data = $formatter->getData($this->getInspector());
     $json = json_encode($data, JSON_PARTIAL_OUTPUT_ON_ERROR | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT);
     $data = [];
     $data['event'] = 'exception';
     //$data['event-id'] = Uuid::uuid4();
     $data['datetime'] = date('Y-m-d H:i:s');
     $data['json'] = $json;
     /*
     if ($user) {
         $data['user'] = [
             'name' => $user->getName(),
             'display_name' => $user->getDisplayName(),
             'email' => $user->getEmail(),
             'mobile' => $user->getMobile()
         ];
     }
     */
     $verify = __DIR__ . '/../../cacert.pem';
     if (!file_exists($verify)) {
         throw new RuntimeException($verify . ' not found');
     }
     $headers = ['Content-Type' => 'application/json'];
     $guzzle = new \GuzzleHttp\Client(['headers' => $headers, 'verify' => $verify]);
     $response = $guzzle->request('POST', $this->url, ['json' => $data]);
     return Handler::DONE;
 }
 /**
  * @inherit
  */
 public function handle()
 {
     $formatter = new Formatter();
     $data = $formatter->getData($this->getInspector());
     $json = json_encode($data, JSON_PARTIAL_OUTPUT_ON_ERROR | JSON_UNESCAPED_SLASHES);
     $path = $this->application->getRootPath() . '/app/logs/exceptions';
     if (!file_exists($path)) {
         mkdir($path, 0777, true);
     }
     $filename = $path . '/' . date('Ymd-His') . '-' . sha1(rand()) . '.json';
     file_put_contents($filename, $json);
     return Handler::DONE;
 }