public function __construct(array $args = array()) { // Store self to allow access in callbacks. self::$current = $this; $this->args = $args; $this->cgi_data = Environment::factory(Arr::get($args, 'cgi_data')); $this->project_root = Arr::get($args, 'project_root'); $this->url = Arr::get($args, 'url', $this->cgi_data['url']); $this->environment_name = Arr::get($args, 'environment_name'); $this->notifier_name = Arr::get($args, 'notifier_name'); $this->notifier_version = Arr::get($args, 'notifier_version'); $this->notifier_url = Arr::get($args, 'notifier_url'); $this->ignore = Arr::get($args, 'ignore', array()); $this->ignore_by_filters = Arr::get($args, 'ignore_by_filters', array()); $this->backtrace_filters = Arr::get($args, 'backtrace_filters', array()); $this->params_filters = Arr::get($args, 'params_filters', array()); if (isset($args['parameters'])) { $this->params = $args['parameters']; } elseif (isset($args['params'])) { $this->params = $args['params']; } if (isset($args['component'])) { $this->component = $args['component']; } elseif (isset($args['controller'])) { $this->component = $args['controller']; } elseif (isset($this->params['controller'])) { $this->component = $this->params['controller']; } if (isset($args['action'])) { $this->action = $args['action']; } elseif (isset($this->params['action'])) { $this->action = $this->params['action']; } $this->exception = Arr::get($args, 'exception'); if ($this->exception instanceof \Exception) { $backtrace = $this->exception->getTrace(); if (empty($backtrace)) { $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); } $this->error_class = get_class($this->exception); $this->error_message = HoneybadgerError::text($this->exception); } else { if (isset($args['backtrace']) and is_array($args['backtrace'])) { $backtrace = $args['backtrace']; } else { $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); } $this->error_class = Arr::get($args, 'error_class'); $this->error_message = Arr::get($args, 'error_message', 'Notification'); } $this->backtrace = Backtrace::parse($backtrace, array('filters' => $this->backtrace_filters)); $this->hostname = gethostname(); $this->source_extract_radius = Arr::get($args, 'source_extract_radius', 2); $this->source_extract = $this->extract_source_from_backtrace(); $this->send_request_session = Arr::get($args, 'send_request_session', TRUE); $this->find_session_data(); $this->clean_params(); $this->set_context(); }
public function test_url_returns_null_when_empty_host_and_path() { $env = Environment::factory(array()); $this->assertNull($env->url); }