return $this->secure($value); } /** * Determines a default port, depending on whether a secure connection is * configured. * * @return integer Default port */ private function default_port() { return $this->is_secure() ? 443 : 80; } /** * Determines the path to the certificate authority bundled with * the library. * * @return string Path to certificate authority bundle. */ private function default_certificate_authority() { return realpath(__DIR__ . '/../../resources/ca-bundle.crt'); } public function offsetUnset($option) { $this->{$option} = NULL; } } // End Config // Additional measure to ensure defaults are initialized. Honeybadger::init();
private function set_context() { $this->context = Honeybadger::context(); if (isset($this->args['context']) and is_array($this->args['context'])) { $this->context = array_merge($this->context, $this->args['context']); } if (empty($this->context)) { $this->context = NULL; } }
<?php /** * Notify with custom options. See lib/Honeybadger/Notice.php for * available options. */ use Honeybadger\Honeybadger; $options = (include 'config.php'); Honeybadger::$config->values($options); echo Honeybadger::notify(array('error_class' => 'Special Error', 'error_message' => 'A custom error message.', 'parameters' => array('action' => 'index', 'username' => 'somebody', 'password' => 'something')));
public function test_should_deliver_to_sender_and_return_result() { $notice = $this->build_notice(); $sender = $this->getMock('Honeybadger\\Sender', array('send_to_honeybadger')); $sender->expects($this->once())->method('send_to_honeybadger')->with($this->equalTo($notice))->will($this->returnValue('win')); $original_sender = Honeybadger::$sender; Honeybadger::$sender = $sender; $this->assertEquals('win', $notice->deliver()); Honeybadger::$sender = $original_sender; }
public function tearDown() { Honeybadger::$sender = new Sender(); parent::tearDown(); }
/** * @return void */ private function notify_honeybadger(\Exception $exception) { $env = $this->app->environment(); if (!$this->ignored_user_agent($env)) { return $env['honeybadger.error_id'] = Honeybadger::notify_or_ignore($exception, $this->notice_options($env)); } }
<?php /** * When all else fails, capture *everything* else that slips through. */ use Honeybadger\Honeybadger; $options = (include 'config.php'); Honeybadger::$config->values($options); Honeybadger::handle_errors(); // Reference an undefined variable. echo $foo;
<?php /** * Catch and notify of an exception you caught in your app. */ use Honeybadger\Honeybadger; $options = (include 'config.php'); Honeybadger::$config->values($options); try { throw new Exception('Oh noes! Something broke!'); } catch (Exception $e) { echo Honeybadger::notify_or_ignore($e); }