From 4977f997976ed506759d84e74efc0c5726e33217 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Mon, 8 Feb 2021 22:03:09 +0100 Subject: [PATCH] Use LoggerAwareTrait Instead of implementing setLogger() ourselves --- classes/Downloader.php | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/classes/Downloader.php b/classes/Downloader.php index 2b0b4f9..12b1d7d 100644 --- a/classes/Downloader.php +++ b/classes/Downloader.php @@ -15,15 +15,17 @@ use Alltube\Library\Exception\WrongPasswordException; use Alltube\Library\Exception\YoutubedlException; use GuzzleHttp\Client; use Psr\Http\Message\ResponseInterface; -use Psr\Log\LoggerInterface; +use Psr\Log\LoggerAwareInterface; +use Psr\Log\LoggerAwareTrait; use Psr\Log\NullLogger; use Symfony\Component\Process\Process; /** * Class used to call youtube-dl and download videos. */ -class Downloader +class Downloader implements LoggerAwareInterface { + use LoggerAwareTrait; /** * youtube-dl binary path. @@ -68,11 +70,6 @@ class Downloader */ private $params; - /** - * @var LoggerInterface - */ - private $logger; - /** * Downloader constructor. * @param string $youtubedl youtube-dl binary path @@ -100,15 +97,6 @@ class Downloader $this->logger = new NullLogger(); } - /** - * @param LoggerInterface $logger - * @return void - */ - public function setLogger(LoggerInterface $logger) - { - $this->logger = $logger; - } - /** * @param string $webpageUrl URL of the page containing the video * @param string $requestedFormat Requested video format