Completed
Push — master ( ddda9f...32824e )
by Adam
02:20
created

Helpers::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
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
}
60