Completed
Push — master ( 32824e...0837b5 )
by Adam
02:14
created

Helpers::getGravatarService()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
/**
3
 * Helpers.php
4
 *
5
 * @copyright      More in license.md
6
 * @license        http://www.ipublikuj.eu
7
 * @author         Adam Kadlec http://www.ipublikuj.eu
8
 * @package        iPublikuj:Gravatar!
9
 * @subpackage     Templating
10
 * @since          1.0.0
11
 *
12
 * @date           05.04.14
13
 */
14
15
declare(strict_types = 1);
16
17
namespace IPub\Gravatar\Templating;
18
19
use Nette;
20
21
use Latte\Engine;
22
23
use IPub\Gravatar;
24
25
/**
26
 * Gravatar template filters
27
 *
28
 * @package        iPublikuj:Gravatar!
29
 * @subpackage     Templating
30
 *
31
 * @author         Adam Kadlec <[email protected]>
32
 */
33 1
final class Helpers extends Nette\Object
34
{
35
	/**
36
	 * @var Gravatar\Gravatar
37
	 */
38
	private $gravatar;
39
40
	/**
41
	 * @param Gravatar\Gravatar $gravatar
42
	 */
43
	public function __construct(Gravatar\Gravatar $gravatar)
44
	{
45 1
		$this->gravatar = $gravatar;
46 1
	}
47
48
	/**
49
	 * @param string $email
50
	 * @param int|NULL $size
51
	 *
52
	 * @return string
53
	 */
54
	public function gravatar(string $email, int $size = NULL) : string
55
	{
56 1
		return $this->gravatar
57 1
			->buildUrl($email, $size);
58
	}
59 1
60
	/**
61
	 * @return Gravatar\Gravatar
62
	 */
63
	public function getGravatarService() : Gravatar\Gravatar
64
	{
65
		return $this->gravatar;
66
	}
67
}
68