Completed
Push — master ( 1e5574...2c7872 )
by C
06:04
created

HostFactoryAwareTrait::getDownloader()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
rs 9.4285
cc 2
eloc 4
nc 2
nop 1
1
<?php
2
namespace Tartana\Mixins;
3
use Tartana\Host\HostFactory;
4
5
trait HostFactoryAwareTrait
6
{
7
8
	private $factory = null;
9
10
	public function getHostFactory ()
11
	{
12
		return $this->factory;
13
	}
14
15
	public function setHostFactory (HostFactory $factory = null)
16
	{
17
		$this->factory = $factory;
18
	}
19
20
	public function getDownloader ($url)
21
	{
22
		if ($this->getHostFactory())
23
		{
24
			return $this->getHostFactory()->createHostDownloader($url);
25
		}
26
		return null;
27
	}
28
}
29