Helpers   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 85.71%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 40
rs 10
c 0
b 0
f 0
ccs 6
cts 7
cp 0.8571

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A gravatar() 0 5 1
A getGravatarService() 0 4 1
1
<?php
2
/**
3
 * Helpers.php
4
 *
5
 * @copyright      More in license.md
6
 * @license        https://www.ipublikuj.eu
7
 * @author         Adam Kadlec <[email protected]>
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 IPub\Gravatar;
22
23
/**
24
 * Gravatar template filters
25
 *
26
 * @package        iPublikuj:Gravatar!
27
 * @subpackage     Templating
28
 *
29
 * @author         Adam Kadlec <[email protected]>
30
 */
31 1
final class Helpers
32
{
33
	/**
34
	 * Implement nette smart magic
35
	 */
36 1
	use Nette\SmartObject;
37
38
	/**
39
	 * @var Gravatar\Gravatar
40
	 */
41
	private $gravatar;
42
43
	/**
44
	 * @param Gravatar\Gravatar $gravatar
45
	 */
46
	public function __construct(Gravatar\Gravatar $gravatar)
47
	{
48 1
		$this->gravatar = $gravatar;
49 1
	}
50
51
	/**
52
	 * @param string $email
53
	 * @param int|NULL $size
54
	 *
55
	 * @return string
56
	 */
57
	public function gravatar(string $email, ?int $size = NULL) : string
58
	{
59 1
		return $this->gravatar
60 1
			->buildUrl($email, $size);
61
	}
62
63
	/**
64
	 * @return Gravatar\Gravatar
65
	 */
66
	public function getGravatarService() : Gravatar\Gravatar
67
	{
68
		return $this->gravatar;
69
	}
70
}
71