Completed
Push — master ( 497829...e64970 )
by
unknown
03:58
created

MediaAdminController::imageRedirectAction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 0
cts 4
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
crap 2
1
<?php
2
3
namespace MediaMonks\SonataMediaBundle\Controller;
4
5
use Sonata\AdminBundle\Controller\CRUDController;
6
use Symfony\Component\HttpFoundation\Request;
7
8
class MediaAdminController extends CRUDController
9
{
10
    /**
11
     * @return \Symfony\Component\HttpFoundation\Response
12
     */
13
    public function createAction()
14
    {
15
        if (!$this->getRequest()->get('provider') && $this->getRequest()->isMethod('get')) {
16
            return $this->render(
17
                '@MediaMonksSonataMedia/MediaAdmin/select_provider.html.twig',
18
                [
19
                    'providers'     => $this->get('mediamonks.sonata_media.provider.pool')->getProviders(),
20
                    'base_template' => $this->getBaseTemplate(),
21
                    'admin'         => $this->admin,
22
                    'action'        => 'create',
23
                ]
24
            );
25
        }
26
27
        return parent::createAction();
28
    }
29
30
    /**
31
     * @param Request $request
32
     * @param int $id
33
     * @return \Symfony\Component\HttpFoundation\RedirectResponse
34
     */
35
    public function imageRedirectAction(Request $request, $id)
36
    {
37
        $media = $this->getDoctrine()->getManager()->find('MediaMonksSonataMediaBundle:Media', $id);
0 ignored issues
show
Unused Code introduced by
$media is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
38
39
40
    }
41
}
42