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

PostvoteShareEvents::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 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
}