Completed
Push — master ( 12d04d...f0be6a )
by Albert
02:59
created

TagCloud   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
c 1
b 0
f 1
lcom 1
cbo 2
dl 0
loc 30
ccs 0
cts 14
cp 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getName() 0 4 1
A getHTML() 0 6 1
1
<?php
2
3
namespace Albert221\Blog\Sidebar\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