From cd3f9f1e5071e393a5f592cd54838c6f53212c93 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sun, 9 Aug 2015 17:52:11 +0100 Subject: [PATCH] CS fixes, refs #623 --- src/Monolog/Handler/IFTTTHandler.php | 73 ++++++++++++++-------------- 1 file changed, 36 insertions(+), 37 deletions(-) diff --git a/src/Monolog/Handler/IFTTTHandler.php b/src/Monolog/Handler/IFTTTHandler.php index 7dcaebd5..0ab45d72 100644 --- a/src/Monolog/Handler/IFTTTHandler.php +++ b/src/Monolog/Handler/IFTTTHandler.php @@ -20,45 +20,44 @@ use Monolog\Logger; */ class IFTTTHandler extends AbstractProcessingHandler { - protected $_eventName; - protected $_secretKey; + private $eventName; + private $secretKey; - /** - * @param string $eventName The name of the IFTTT Maker event that should be triggered - * @param string $secretKey A valid IFTTT secret key - * @param integer $level The minimum logging level at which this handler will be triggered - * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not - */ - public function __construct($eventName, $secretKey, $level = Logger::ERROR, $bubble = true) - { - $this->_eventName = $eventName; - $this->_secretKey = $secretKey; + /** + * @param string $eventName The name of the IFTTT Maker event that should be triggered + * @param string $secretKey A valid IFTTT secret key + * @param integer $level The minimum logging level at which this handler will be triggered + * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not + */ + public function __construct($eventName, $secretKey, $level = Logger::ERROR, $bubble = true) + { + $this->eventName = $eventName; + $this->secretKey = $secretKey; - parent::__construct($level, $bubble); - } + parent::__construct($level, $bubble); + } - /** - * {@inheritdoc} - */ - public function write(array $record) - { - $postData = array( - "value1" => $record["channel"], - "value2" => $record["level_name"], - "value3" => $record["message"] - ); - $postString = json_encode($postData); + /** + * {@inheritdoc} + */ + public function write(array $record) + { + $postData = array( + "value1" => $record["channel"], + "value2" => $record["level_name"], + "value3" => $record["message"] + ); + $postString = json_encode($postData); - $ch = curl_init(); + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, "https://maker.ifttt.com/trigger/" . $this->eventName . "/with/key/" . $this->secretKey); + curl_setopt($ch, CURLOPT_POST, true); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_POSTFIELDS, $postString); + curl_setopt($ch, CURLOPT_HTTPHEADER, array( + "Content-Type: application/json" + )); - curl_setopt($ch, CURLOPT_URL, "https://maker.ifttt.com/trigger/" . $this->_eventName . "/with/key/" . $this->_secretKey); - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_POSTFIELDS, $postString); - curl_setopt($ch, CURLOPT_HTTPHEADER, array( - "Content-Type: application/json" - )); - - Curl\Util::execute($ch); - } -} \ No newline at end of file + Curl\Util::execute($ch); + } +}