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

HostFactoryAwareTrait::setHostFactory()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
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