GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Comment::__invoke()   B
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 27
Code Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 27
rs 8.8571
c 0
b 0
f 0
cc 3
eloc 19
nc 2
nop 1
1
<?php
2
namespace RbComment\View\Helper;
3
4
use RbComment\Form\CommentForm;
5
use RbComment\Model\CommentTable;
6
use Zend\View\Helper\AbstractHelper;
7
8
class Comment extends AbstractHelper
9
{
10
    protected $themes = [
11
        'default'    => true,
12
        'uikit'      => true,
13
        'bootstrap3' => true,
14
    ];
15
16
    private $viewHelperManager;
17
    private $routerService;
18
    private $configService;
19
    private $commentTable;
20
21
    public function __construct(
22
        $viewHelperManager,
23
        $routerService,
24
        array $configService,
25
        CommentTable $commentTable
26
    ) {
27
        $this->viewHelperManager = $viewHelperManager;
28
        $this->routerService     = $routerService;
29
        $this->configService     = $configService;
30
        $this->commentTable      = $commentTable;
31
    }
32
33
    public function __invoke($theme = 'default')
34
    {
35
        // If using a custom theme/partial do not append the prefix
36
        $invokablePartial = isset($this->themes[$theme])
37
            ? 'rbcomment/theme/' . $theme
38
            : $theme;
39
40
        $uri = $this->routerService->getRequestUri()->getPath();
41
        $thread = sha1($uri);
42
        $validationMessages = $this->viewHelperManager->get('flashMessenger')
43
                                                      ->getMessagesFromNamespace('RbComment');
44
45
        $strings = $this->configService['rb_comment']['strings'];
46
47
        echo $this->viewHelperManager->get('partial')->__invoke($invokablePartial, [
48
            'comments'          => $this->commentTable->fetchAllForThread($thread),
49
            'form'              => new CommentForm($strings),
50
            'thread'            => $thread,
51
            'validationResults' => count($validationMessages) > 0
52
                ? json_decode(array_shift($validationMessages))
53
                : [],
54
            'uri'               => $uri,
55
            'strings'           => $strings,
56
            'zfc_user'          => $this->configService['rb_comment']['zfc_user']['enabled'],
57
            'gravatar'          => $this->configService['rb_comment']['gravatar']['enabled'],
58
        ]);
59
    }
60
}
61