diff options
author | Jordi Boggiano <j.boggiano@seld.be> | 2016-05-26 18:16:46 +0100 |
---|---|---|
committer | Jordi Boggiano <j.boggiano@seld.be> | 2016-05-26 18:16:46 +0100 |
commit | 3d7842ec1ef2230877680dc94af15d6505e94bff (patch) | |
tree | 08d5ea962419dc3a4654dd7053ce642e3116fd19 /src | |
parent | 8a379a3166675684416ea8ccd86f7d1e4f2711e3 (diff) | |
download | monolog-3d7842ec1ef2230877680dc94af15d6505e94bff.zip monolog-3d7842ec1ef2230877680dc94af15d6505e94bff.tar.gz monolog-3d7842ec1ef2230877680dc94af15d6505e94bff.tar.bz2 |
Coding style fixes, refs #720
Diffstat (limited to 'src')
-rw-r--r-- | src/Monolog/Handler/ProcessHandler.php | 36 |
1 files changed, 8 insertions, 28 deletions
diff --git a/src/Monolog/Handler/ProcessHandler.php b/src/Monolog/Handler/ProcessHandler.php index 8101aa7..3cdda13 100644 --- a/src/Monolog/Handler/ProcessHandler.php +++ b/src/Monolog/Handler/ProcessHandler.php @@ -67,37 +67,17 @@ class ProcessHandler extends AbstractProcessingHandler */ public function __construct($command, $level = Logger::DEBUG, $bubble = true, $cwd = null) { - $this->guardAgainstInvalidCommand($command); - $this->guardAgainstInvalidCwd($cwd); - - parent::__construct($level, $bubble); - - $this->command = $command; - $this->cwd = $cwd; - } - - /** - * @param string $command - * @throws \InvalidArgumentException - * @return void - */ - private function guardAgainstInvalidCommand($command) - { if (empty($command) || is_string($command) === false) { throw new \InvalidArgumentException('The command argument must be a non-empty string.'); } - } - - /** - * @param string $cwd - * @throws \InvalidArgumentException - * @return void - */ - private function guardAgainstInvalidCwd($cwd) - { if ($cwd !== null && (empty($cwd) || is_string($cwd) === false)) { throw new \InvalidArgumentException('The optional CWD argument must be a non-empty string, if any.'); } + + parent::__construct($level, $bubble); + + $this->command = $command; + $this->cwd = $cwd; } /** @@ -156,7 +136,6 @@ class ProcessHandler extends AbstractProcessingHandler */ private function handleStartupErrors() { - $selected = $this->selectErrorStream(); if (false === $selected) { throw new \UnexpectedValueException('Something went wrong while selecting a stream.'); @@ -180,6 +159,7 @@ class ProcessHandler extends AbstractProcessingHandler { $empty = []; $errorPipes = [$this->pipes[2]]; + return stream_select($errorPipes, $empty, $empty, 1); } @@ -203,7 +183,7 @@ class ProcessHandler extends AbstractProcessingHandler */ protected function writeProcessInput($string) { - fwrite($this->pipes[0], (string)$string); + fwrite($this->pipes[0], (string) $string); } /** @@ -216,7 +196,7 @@ class ProcessHandler extends AbstractProcessingHandler fclose($pipe); } proc_close($this->process); + $this->process = null; } - $this->process = null; } } |