/** * For initial settings purposes */ protected function initialize($options) { $this->config = ConfigManager::bind(); $this->event_dispatcher = EventDispatcher::bind(); $this->primary_url_target = $options['url_target']; $this->instance_identifier = $options['instance_identifier']; $this->stop_condition_adquired = FALSE; $this->event_dispatcher->connect('context.webbot_injected', array($this, 'ContextWebbotInjectedEventHandler')); //$this->event_dispatcher->connect('webbot.stop_condition_adquired', array($this, 'WebbotStopConditionAdquiredEventHandler')); }
/** * Unleashed the routine for loggin the exception * */ private function notifyException() { $parameters = array("type" => get_class($this), "message" => $this->getMessage(), "file" => $this->file, "line" => $this->line); if ($this->getPrevious() !== NULL) { $parameters["inner_type"] = get_class($this->getPrevious()); $parameters["inner_message"] = $this->getPrevious()->getMessage(); $parameters["inner_file"] = $this->getPrevious()->getFile(); $parameters["inner_line"] = $this->getPrevious()->getLine(); } $dispatcher = EventDispatcher::bind(); // notifying exception $dispatcher->notify(new Event($this, 'application.log_exception', $parameters)); }
private static function logActivity($url, $referer, $agent, $method, $http_code) { EventDispatcher::bind()->notify(new Event(NULL, 'http_scraper.log', array('url' => $url, 'referer' => $referer, 'agent' => $agent, 'method' => $method, 'http_code' => $http_code))); }
/** * Static Builder * * @param Webbot $webbot * @return Webbot */ public static function createInstance(Webbot $webbot) { $context = self::bind(); $context['webbot'] = $webbot; EventDispatcher::bind()->notify(new Event($context, 'context.webbot_injected')); return $context; }