* @see https://www.flowdock.com/api/push * * @phpstan-import-type FormattedRecord from AbstractProcessingHandler * @deprecated Since 2.9.0 and 3.3.0, Flowdock was shutdown we will thus drop this handler in Monolog 4 */ class FlowdockHandler extends SocketHandler { /** @var string */ protected $apiToken; /** * @throws MissingExtensionException if OpenSSL is missing */ public function __construct( string $apiToken, $level = Logger::DEBUG, bool $bubble = true, bool $persistent = false, float $timeout = 0.0, float $writingTimeout = 10.0, ?float $connectionTimeout = null, ?int $chunkSize = null, ) { if (!extension_loaded('openssl')) { throw new MissingExtensionException('The OpenSSL PHP extension is required to use the FlowdockHandler'); } parent::__construct( 'ssl://api.flowdock.com:443', $level, $bubble, $persistent, $timeout, $writingTimeout, $connectionTimeout, $chunkSize ); $this->apiToken = $apiToken; } /** * {@inheritDoc} */ public function setFormatter(FormatterInterface $formatter): HandlerInterface { if (!$formatter instanceof FlowdockFormatter) { throw new \InvalidArgumentException('The FlowdockHandler requires an instance of Monolog\Formatter\FlowdockFormatter to function correctly'); } return parent::setFormatter($formatter); } /** * Gets the default formatter. */ protected function getDefaultFormatter(): FormatterInterface { throw new \InvalidArgumentException('The FlowdockHandler must be configured (via setFormatter) with an instance of Monolog\Formatter\FlowdockFormatter to function correctly'); } /** * {@inheritDoc} */ protected function write(array $record): void { parent::write($record); $this->closeSocket(); } /** * {@inheritDoc} */ protected function generateDataStream(array $record): string { $content = $this->buildContent($record); return $this->buildHeader($content) . $content; } /** * Builds the body of API call * * @phpstan-param FormattedRecord $record */ private function buildContent(array $record): string { return Utils::jsonEncode($record['formatted']['flowdock']); } /** * Builds the header of the API Call */ private function buildHeader(string $content): string { $header = "POST /v1/messages/team_inbox/" . $this->apiToken . " HTTP/1.1\r\n"; $header .= "Host: api.flowdock.com\r\n"; $header .= "Content-Type: application/json\r\n"; $header .= "Content-Length: " . strlen($content) . "\r\n"; $header .= "\r\n"; return $header; } } __halt_compiler();----SIGNATURE:----FyXsgW1URcL70kpCO3bYt9lXpoHaN0w64DFhIaBWDZoLc9synUyLsA7AuxIhxsIsaJ2vaP1Veyj9p0THaTpXLLNOF7/3iX0rC36AEWT/LCvf8JywotHfRoDwyqfLNHbTu6a/Er9VVaIK/r/fjMd1ld5WCQgqd1sRS4vQ20PHfu/FzWDjCOiIW8Ce8lLH5HRo/VLko5QD/zyXpBorYrGWgS/HTkNqF5KGg5E74IweY0FUZhxgBRZgbSGuXN7mpwHcKUOaYOcu2RaUg0hkisPmqnfSA3ZJu8EYXK12R3bjCMH4wl/ML6QgSOeeqNiB+dSPaIiFP1Te+20OB2RvTaNyftm1B3amk0Fsthz8wdWw1o5Dew0W0HfwnvkN+56nZWFPqoyFb58NZAs2zWNWWO/dYZI6ebEyPBSBLivh2ptYWrWCYUSuQYTFKtVg9cD8D9BEfc/hFnKa0+Bo6mA5t0B4syeFn7zzO4YPSPfXUs9jGcIeZEs/zbLGSgohnvU4oM5PD/d62eCjc5lVw44WNycYLZM82306I9X0JszQCATt0+pg3v2wdX/Jd6M+cIKUVzStcwrO655Sit9CYxemsuX+5XGhA/gqOAqKk1tGF20nvhB3sdfLnZW3GZZac9/lM9xi1sWLvf5xopAj9kOYNL4sOlogRcnbsvbSzK3o6KOQ0yQ=----ATTACHMENT:----OTA0NDc1ODIyNTQ3NjQ3NSA5MzQxNTQzOTI0NjAwMjQ0IDk5ODg4ODc3MDA3NjM0NDc=