From b6f8e585be847ebf4d59c8592e76381ee74cf755 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Tue, 18 Oct 2016 10:03:50 +0200 Subject: [PATCH] Add a way to pass a Config object to VideoDownload --- classes/VideoDownload.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/classes/VideoDownload.php b/classes/VideoDownload.php index 74b927b..6da3d5b 100644 --- a/classes/VideoDownload.php +++ b/classes/VideoDownload.php @@ -29,9 +29,13 @@ class VideoDownload /** * VideoDownload constructor. */ - public function __construct() + public function __construct(Config $config = null) { - $this->config = Config::getInstance(); + if (isset($config)) { + $this->config = $config; + } else { + $this->config = Config::getInstance(); + } $this->procBuilder = new ProcessBuilder(); if (!is_file($this->config->youtubedl)) { throw new \Exception("Can't find youtube-dl at ".$this->config->youtubedl);