From 108bcff40923ad7363f33e27338d1e2ec6026147 Mon Sep 17 00:00:00 2001 From: pomaxa Date: Wed, 30 Sep 2015 00:35:33 +0300 Subject: [PATCH 1/3] simplify isset/unset --- src/Monolog/Formatter/ChromePHPFormatter.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Monolog/Formatter/ChromePHPFormatter.php b/src/Monolog/Formatter/ChromePHPFormatter.php index 56d3e278..9beda1e7 100644 --- a/src/Monolog/Formatter/ChromePHPFormatter.php +++ b/src/Monolog/Formatter/ChromePHPFormatter.php @@ -41,10 +41,9 @@ class ChromePHPFormatter implements FormatterInterface { // Retrieve the line and file if set and remove them from the formatted extra $backtrace = 'unknown'; - if (isset($record['extra']['file']) && isset($record['extra']['line'])) { + if (isset($record['extra']['file'], $record['extra']['line'])) { $backtrace = $record['extra']['file'].' : '.$record['extra']['line']; - unset($record['extra']['file']); - unset($record['extra']['line']); + unset($record['extra']['file'], $record['extra']['line']); } $message = array('message' => $record['message']); From 5b05c66429d423df893dd674d2e443ea613b11cf Mon Sep 17 00:00:00 2001 From: pomaxa Date: Wed, 30 Sep 2015 00:53:37 +0300 Subject: [PATCH 2/3] php doc for throw exception --- src/Monolog/Handler/SlackHandler.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Monolog/Handler/SlackHandler.php b/src/Monolog/Handler/SlackHandler.php index 61245ffa..2399a395 100644 --- a/src/Monolog/Handler/SlackHandler.php +++ b/src/Monolog/Handler/SlackHandler.php @@ -79,6 +79,7 @@ class SlackHandler extends SocketHandler * @param bool $bubble Whether the messages that are handled can bubble up the stack or not * @param bool $useShortAttachment Whether the the context/extra messages added to Slack as attachments are in a short style * @param bool $includeContextAndExtra Whether the attachment should include context and extra data + * @throws MissingExtensionException If no OpenSSL PHP extension configured */ public function __construct($token, $channel, $username = 'Monolog', $useAttachment = true, $iconEmoji = null, $level = Logger::CRITICAL, $bubble = true, $useShortAttachment = false, $includeContextAndExtra = false) { From fc077b81720b0616b9041bfddd99ee2b460cc3b0 Mon Sep 17 00:00:00 2001 From: pomaxa Date: Wed, 30 Sep 2015 01:08:08 +0300 Subject: [PATCH 3/3] * fix var passed to curl::execute * phpdoc * remove defining null for class props. --- src/Monolog/Handler/CubeHandler.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/Monolog/Handler/CubeHandler.php b/src/Monolog/Handler/CubeHandler.php index e7dd854b..d88fed48 100644 --- a/src/Monolog/Handler/CubeHandler.php +++ b/src/Monolog/Handler/CubeHandler.php @@ -21,11 +21,11 @@ use Monolog\Logger; */ class CubeHandler extends AbstractProcessingHandler { - private $udpConnection = null; - private $httpConnection = null; - private $scheme = null; - private $host = null; - private $port = null; + private $udpConnection; + private $httpConnection; + private $scheme; + private $host; + private $port; private $acceptedSchemes = array('http', 'udp'); /** @@ -39,7 +39,7 @@ class CubeHandler extends AbstractProcessingHandler { $urlInfos = parse_url($url); - if (!isset($urlInfos['scheme']) || !isset($urlInfos['host']) || !isset($urlInfos['port'])) { + if (!isset($urlInfos['scheme'], $urlInfos['host'], $urlInfos['port'])) { throw new \UnexpectedValueException('URL "'.$url.'" is not valid'); } @@ -60,6 +60,7 @@ class CubeHandler extends AbstractProcessingHandler * Establish a connection to an UDP socket * * @throws \LogicException when unable to connect to the socket + * @throws MissingExtensionException when there is no socket extension */ protected function connectUdp() { @@ -79,6 +80,7 @@ class CubeHandler extends AbstractProcessingHandler /** * Establish a connection to a http server + * @throws \LogicException when no curl extension */ protected function connectHttp() { @@ -144,6 +146,6 @@ class CubeHandler extends AbstractProcessingHandler 'Content-Length: ' . strlen('['.$data.']')) ); - Curl\Util::execute($ch, 5, false); + Curl\Util::execute($this->httpConnection, 5, false); } }