Completed
Push — master ( 972dec...29f109 )
by greg
31:27 queued 13:20
created

PostvoteShareEvents   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 4
dl 0
loc 22
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __invoke() 0 12 1
1
<?php
2
3
namespace PlaygroundGame\View\Helper;
4
5
use Zend\View\Helper\AbstractHelper;
6
7
class PostvoteShareEvents extends AbstractHelper
8
{
9
    protected $service = null;
10
11
    public function __construct(\PlaygroundGame\Service\PostVote $service)
12
    {
13
        $this->service = $service;
14
    }
15
16
    public function __invoke($identifier)
17
    {
18
        // this is possible to create a specific game design in /design/frontend/default/custom.
19
        //It will precede all others templates.
20
        $templatePathResolver = $this->service->getServiceManager()->get('Zend\View\Resolver\TemplatePathStack');
21
        $l = $templatePathResolver->getPaths();
22
        $templatePathResolver->addPath($l[0].'custom/'.$identifier);
23
        $game = $this->service->checkGame($identifier, false);
24
        $comments = $this->service->getCommentsForPostvote($game);
25
26
        return $this->getView()->render('playground-game/post-vote/widget/share-events', array('comments' => $comments));
27
    }
28
}