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

HostFactoryAwareTrait   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 24
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getHostFactory() 0 4 1
A setHostFactory() 0 4 1
A getDownloader() 0 8 2
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