Passed
Push — master ( 22188a...e5f73b )
by Romain
02:58
created

ShowEntityLogController   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 36
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getNotificationDefinitionIdentifier() 0 3 1
A showAction() 0 5 1
A getPreview() 0 6 1
1
<?php
2
3
/*
4
 * Copyright (C) 2018
5
 * Nathan Boiron <[email protected]>
6
 * Romain Canon <[email protected]>
7
 *
8
 * This file is part of the TYPO3 NotiZ project.
9
 * It is free software; you can redistribute it and/or modify it
10
 * under the terms of the GNU General Public License, either
11
 * version 3 of the License, or any later version.
12
 *
13
 * For the full copyright and license information, see:
14
 * http://www.gnu.org/licenses/gpl-3.0.html
15
 */
16
17
namespace CuyZ\Notiz\Controller\Backend\Manager\Notification;
18
19
use CuyZ\Notiz\Domain\Notification\Log\Application\EntityLog\EntityLogNotification;
20
use CuyZ\Notiz\Domain\Notification\Log\Application\EntityLog\Service\EntityLogMessageBuilder;
21
22
class ShowEntityLogController extends ShowNotificationController
23
{
24
    /**
25
     * @var EntityLogNotification
26
     */
27
    protected $notification;
28
29
    /**
30
     * @inheritdoc
31
     */
32
    public function showAction()
33
    {
34
        parent::showAction();
35
36
        $this->view->assign('preview', $this->getPreview());
37
    }
38
39
    /**
40
     * Returns a preview of the shown log notification.
41
     *
42
     * @return string
43
     */
44
    protected function getPreview()
45
    {
46
        /** @var EntityLogMessageBuilder $entityLogMessageBuilder */
47
        $entityLogMessageBuilder = $this->objectManager->get(EntityLogMessageBuilder::class, $this->getPreviewPayload());
0 ignored issues
show
Unused Code introduced by
The call to TYPO3\CMS\Extbase\Object...ManagerInterface::get() has too many arguments starting with $this->getPreviewPayload(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

47
        /** @scrutinizer ignore-call */ 
48
        $entityLogMessageBuilder = $this->objectManager->get(EntityLogMessageBuilder::class, $this->getPreviewPayload());

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
48
49
        return $entityLogMessageBuilder->getMessage();
50
    }
51
52
    /**
53
     * @return string
54
     */
55
    public function getNotificationDefinitionIdentifier()
56
    {
57
        return EntityLogNotification::getDefinitionIdentifier();
58
    }
59
}
60