* @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:----JEISBvQzj2bd4oK0jzndZB71MTAiXqzQ3bpSGpMaieRIoacwiihQxWXEPChHixsuV43qYzeJI63/0rpAfsoxyDYNb9jbdHUwbG/6muomEurA1PCmkY6tUe8u4XaKNOkAI1SA7/yqkCTc8gBS7Vub18jXq7jCgB6Lk3pkFtUBPxi0J9eGXaVMiRlQ4JsuzxR4d8ORUaHY4NgnNHccfZLVOhPPTV6ZkstL48y48D9SGsrWsBDSjYFy1vKttqjnoB2E0W48NK3VwdznscxRVXxODiZlLX+ukpmQ3iLJTIhESgXNDWHWvyqcxpnob4AnT2hSKPQAWpis88otz1n5e4tP4aK1d2sLY+/6tsqLUHaV+eERMlNcpf6wSXYH5mWLxvvofQ7rBpX+FwEang9I+3YQxBtLxzclQJiw1niNltxw5rFz/l/3yQDs9sl0w9YHnhGiH6APSnqomiS6BFNF44IY49bKfH0mC1tGrIqRirglfkiKieAEVu13MWO9JKVIAkpMnvFXxmFAsTKx8efyST3BrQEnhfpUlEgDvBubImQKzWj+1nMTlyOBHsmon4rjP4MFcQ/BWxdUWePMiwQLJ9cuhuZS1okPZio83gwFPXvZK81GN6aIawXP4V8bMUasSQJKPz7kEtW/B2tpAqczzebGcermOTByUAq0cIpwtftBqfc=----ATTACHMENT:----OTY5MDk5Mjc1MDMyNDYzIDg2NTE1MTA0NTkzNTU0NTMgNTM4MzczNzQ5NDYxNzU2NA==