-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
492 additions
and
1,178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the php-gelf package. | ||
|
@@ -12,6 +13,7 @@ | |
namespace Gelf\Transport; | ||
|
||
use Gelf\Encoder\EncoderInterface; | ||
use Gelf\Encoder\JsonEncoder; | ||
use Gelf\MessageInterface; | ||
use Gelf\PublisherInterface; | ||
|
||
|
@@ -21,22 +23,19 @@ | |
* | ||
* @author Benjamin Zikarsky <[email protected]> | ||
*/ | ||
abstract class AbstractTransport implements TransportInterface, PublisherInterface | ||
abstract class AbstractTransport implements TransportInterface | ||
{ | ||
protected EncoderInterface $messageEncoder; | ||
|
||
/** | ||
* @var EncoderInterface | ||
*/ | ||
protected $messageEncoder; | ||
public function __construct(?EncoderInterface $messageEncoder = null) | ||
{ | ||
$this->messageEncoder = $messageEncoder ?? new JsonEncoder(); | ||
} | ||
|
||
/** | ||
* Sets a message encoder | ||
* | ||
* @param EncoderInterface $encoder | ||
* | ||
* @return $this | ||
*/ | ||
public function setMessageEncoder(EncoderInterface $encoder) | ||
public function setMessageEncoder(EncoderInterface $encoder): self | ||
{ | ||
$this->messageEncoder = $encoder; | ||
|
||
|
@@ -45,27 +44,9 @@ public function setMessageEncoder(EncoderInterface $encoder) | |
|
||
/** | ||
* Returns the current message encoder | ||
* | ||
* @return EncoderInterface | ||
*/ | ||
public function getMessageEncoder() | ||
public function getMessageEncoder(): EncoderInterface | ||
{ | ||
return $this->messageEncoder; | ||
} | ||
|
||
/** | ||
* Alias to send() without return value | ||
* Required to fulfill the PublisherInterface | ||
* | ||
* @deprecated deprecated since 1.1 | ||
* @codeCoverageIgnore | ||
* | ||
* @param MessageInterface $message | ||
* | ||
* @return int the number of bytes sent | ||
*/ | ||
public function publish(MessageInterface $message) | ||
{ | ||
return $this->send($message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.