summaryrefslogtreecommitdiffstats
path: root/application/service
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2016-09-07 21:07:54 +0200
committerFlorian Pritz <bluewind@xinu.at>2016-11-01 17:26:31 +0100
commit9cacd34e325416f62705267cf8217594854492ad (patch)
tree4c99d38b9d63678d181e76a03ef6a5f044b59f03 /application/service
parentcbe1076278ef7ad104a5e8f4805d250c64bd610f (diff)
s/multipaste_queue: Refactor constructor to support dependency injection
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/service')
-rw-r--r--application/service/multipaste_queue.php25
1 files changed, 19 insertions, 6 deletions
diff --git a/application/service/multipaste_queue.php b/application/service/multipaste_queue.php
index 28ff683b7..453ea3429 100644
--- a/application/service/multipaste_queue.php
+++ b/application/service/multipaste_queue.php
@@ -11,13 +11,26 @@ namespace service;
class multipaste_queue {
- public function __construct() {
+ public function __construct($session = null, $mfile = null, $mmultipaste = null) {
$CI =& get_instance();
- $CI->load->model("mfile");
- $CI->load->model("mmultipaste");
- $this->session = $CI->session;
- $this->mfile = $CI->mfile;
- $this->mmultipaste = $CI->mmultipaste;
+
+ $this->session = $session;
+ $this->mfile = $mfile;
+ $this->mmultipaste = $mmultipaste;
+
+ if ($this->session === null) {
+ $this->session = $CI->session;
+ }
+
+ if ($this->mfile === null) {
+ $CI->load->model("mfile");
+ $this->mfile = $CI->mfile;
+ }
+
+ if ($this->mmultipaste === null) {
+ $CI->load->model("mmultipaste");
+ $this->mmultipaste = $CI->mmultipaste;
+ }
}
/**