MediaDeleteItemAction   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 0
dl 0
loc 56
ccs 0
cts 23
cp 0
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getUrlFor() 0 7 1
A getLabelFor() 0 4 1
A getIconFor() 0 4 1
A getTemplate() 0 4 1
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