Completed
Push — master ( d5cb5b...48be88 )
by Adam
02:24
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 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
ccs 0
cts 1
cp 0
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
34
{
35
	/**
36
	 * Implement nette smart magic
37
	 */
38 1
	use Nette\SmartObject;
39
40
	/**
41
	 * @var Gravatar\Gravatar
42
	 */
43
	private $gravatar;
44
45
	/**
46
	 * @param Gravatar\Gravatar $gravatar
47
	 */
48
	public function __construct(Gravatar\Gravatar $gravatar)
49
	{
50 1
		$this->gravatar = $gravatar;
51 1
	}
52
53
	/**
54
	 * @param string $email
55
	 * @param int|NULL $size
56
	 *
57
	 * @return string
58
	 */
59
	public function gravatar(string $email, int $size = NULL) : string
60
	{
61 1
		return $this->gravatar
62 1
			->buildUrl($email, $size);
63
	}
64
65
	/**
66
	 * @return Gravatar\Gravatar
67
	 */
68
	public function getGravatarService() : Gravatar\Gravatar
69
	{
70
		return $this->gravatar;
71
	}
72
}
73