mirror of
https://github.com/Seldaek/monolog.git
synced 2025-10-22 00:56:08 +02:00
Wrap up type-hint adding to all handlers
This commit is contained in:
@@ -34,13 +34,12 @@ class FlowdockHandler extends SocketHandler
|
||||
protected $apiToken;
|
||||
|
||||
/**
|
||||
* @param string $apiToken
|
||||
* @param bool|int $level The minimum logging level at which this handler will be triggered
|
||||
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
|
||||
* @param string|int $level The minimum logging level at which this handler will be triggered
|
||||
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
|
||||
*
|
||||
* @throws MissingExtensionException if OpenSSL is missing
|
||||
*/
|
||||
public function __construct($apiToken, $level = Logger::DEBUG, bool $bubble = true)
|
||||
public function __construct(string $apiToken, $level = Logger::DEBUG, bool $bubble = true)
|
||||
{
|
||||
if (!extension_loaded('openssl')) {
|
||||
throw new MissingExtensionException('The OpenSSL PHP extension is required to use the FlowdockHandler');
|
||||
@@ -84,11 +83,8 @@ class FlowdockHandler extends SocketHandler
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @param array $record
|
||||
* @return string
|
||||
*/
|
||||
protected function generateDataStream($record)
|
||||
protected function generateDataStream(array $record): string
|
||||
{
|
||||
$content = $this->buildContent($record);
|
||||
|
||||
@@ -97,22 +93,16 @@ class FlowdockHandler extends SocketHandler
|
||||
|
||||
/**
|
||||
* Builds the body of API call
|
||||
*
|
||||
* @param array $record
|
||||
* @return string
|
||||
*/
|
||||
private function buildContent($record)
|
||||
private function buildContent(array $record): string
|
||||
{
|
||||
return json_encode($record['formatted']['flowdock']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the header of the API Call
|
||||
*
|
||||
* @param string $content
|
||||
* @return string
|
||||
*/
|
||||
private function buildHeader($content)
|
||||
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";
|
||||
|
Reference in New Issue
Block a user