config = $config; $this->transport = $transport ?: new Transport\Curl(); $this->dumpHandler = new Util\DumpHandler($dataManipulator); static::$instances[] = $this; } public function pushData(...$content) : object|null|bool { $data = $this->dumpHandler->dumpData(...$content); // Make sure not to spam the server if an ErrorMessage or Exception was already sent (like inside a loop) $dumpHash = $this->dumpHandler->hash($data); if ( $this->sent[$dumpHash] ?? false ) { return null; } $this->sent[$dumpHash] = true; $url = $this->config->url('dump/report'); return $url ? $this->transport->push($url, $data) : false; } } } namespace { if (! function_exists('ndump') ) { function ndump(...$content) { foreach (\Negundo\Client\Dump::$instances as $instance) { $instance->pushData(...$content); } } } }