MediaDeleteItemAction::getLabelFor()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Kunstmaan\MediaBundle\AdminList\ItemAction;
4
5
use Kunstmaan\AdminListBundle\AdminList\ItemAction\ItemActionInterface;
6
7
class MediaDeleteItemAction implements ItemActionInterface
8
{
9
    /**
10
     * @var string
11
     */
12
    private $redirectUrl;
13
14
    /**
15
     * @param string $redirectUrl
16
     */
17
    public function __construct($redirectUrl)
18
    {
19
        $this->redirectUrl = $redirectUrl;
20
    }
21
22
    /**
23
     * @param mixed $item
24
     *
25
     * @return array
0 ignored issues
show
Documentation introduced by
Consider making the return type a bit more specific; maybe use array<string,string|array>.

This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.

Loading history...
26
     */
27
    public function getUrlFor($item)
28
    {
29
        return array(
30
          'path' => 'KunstmaanMediaBundle_media_delete',
31
          'params' => array('mediaId' => $item->getId(), 'redirectUrl' => $this->redirectUrl),
32
        );
33
    }
34
35
    /**
36
     * @param mixed $item
37
     *
38
     * @return string
39
     */
40
    public function getLabelFor($item)
41
    {
42
        return 'Delete';
43
    }
44
45
    /**
46
     * @param mixed $item
47
     *
48
     * @return string
49
     */
50
    public function getIconFor($item)
51
    {
52
        return 'remove-sign';
53
    }
54
55
    /**
56
     * @return string
0 ignored issues
show
Documentation introduced by
Should the return type not be string|null?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
57
     */
58
    public function getTemplate()
59
    {
60
        return null;
61
    }
62
}
63