Completed
Push — master ( 2edeb4...8f93c5 )
by Albert
03:04
created

TagCloud::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 5
ccs 0
cts 5
cp 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
crap 2
1
<?php
2
3
namespace Albert221\Blog\Widget;
4
5
use Albert221\Blog\Repository\TagRepositoryInterface;
6
use Twig_Environment;
7
8
class TagCloud implements WidgetInterface
9
{
10
    /**
11
     * @var TagRepositoryInterface
12
     */
13
    private $tags;
14
15
    /**
16
     * @var Twig_Environment
17
     */
18
    private $twig;
19
20
    public function __construct(TagRepositoryInterface $tags, Twig_Environment $twig)
21
    {
22
        $this->tags = $tags;
23
        $this->twig = $twig;
24
    }
25
    
26
    public function getName()
27
    {
28
        return 'Chmura tagów';
29
    }
30
31
    public function getHTML()
32
    {
33
        $tags = $this->tags->paginated(1, 50);
34
        
35
        return $this->twig->render('widgets/tag_cloud.twig', compact('tags'));
36
    }
37
}
38