Completed
Push — master ( ea7885...374980 )
by Ralf
14s queued 12s
created

ShowStatusViewHelper::render()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 27
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 18
nc 2
nop 2
dl 0
loc 27
rs 9.6666
c 0
b 0
f 0
1
<?php
2
namespace EWW\Dpf\ViewHelpers;
3
4
/*
5
 * This file is part of the TYPO3 CMS project.
6
 *
7
 * It is free software; you can redistribute it and/or modify it under
8
 * the terms of the GNU General Public License, either version 2
9
 * of the License, or any later version.
10
 *
11
 * For the full copyright and license information, please read the
12
 * LICENSE.txt file that was distributed with this source code.
13
 *
14
 * The TYPO3 project - inspiring people to share!
15
 */
16
17
use EWW\Dpf\Domain\Workflow\DocumentWorkflow;
18
19
class ShowStatusViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper
20
{
21
    /**
22
     * Maps the internal states to more user friendly and localized state names.
23
     *
24
     * @param string $status
25
     * @param boolean $remote
26
     * @return string
27
     */
28
    public function render($status, $remote = FALSE)
0 ignored issues
show
Unused Code introduced by
The parameter $remote is not used and could be removed. ( Ignorable by Annotation )

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

28
    public function render($status, /** @scrutinizer ignore-unused */ $remote = FALSE)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
29
    {
30
        // A,I and D are the states returned by a repository search.
31
        // The other states are the ones used in the document table.
32
        $statusMapping = [
33
            "A" => 'released',
34
            "I" => 'postponed',
35
            "D" => 'discarded',
36
            DocumentWorkflow::STATE_NEW_NONE => "new",
37
            DocumentWorkflow::STATE_REGISTERED_NONE => "registered",
38
            DocumentWorkflow::STATE_POSTPONED_NONE => "postponed",
39
            DocumentWorkflow::STATE_DISCARDED_NONE => "discarded",
40
            DocumentWorkflow::STATE_IN_PROGRESS_NONE => "inProgress",
41
            DocumentWorkflow::STATE_IN_PROGRESS_ACTIVE => "in_progress",
42
            DocumentWorkflow::STATE_IN_PROGRESS_INACTIVE => "in_progress",
43
            DocumentWorkflow::STATE_IN_PROGRESS_DELETED => "in_progress",
44
        ];
45
46
        if (array_key_exists($status, $statusMapping)) {
47
            return \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate(
48
                "manager.documentList.state.".$statusMapping[$status],
49
                'dpf',
50
                $arguments = null
51
            );
52
        }
53
54
        return "-";
55
    }
56
}
57