Completed
Push — master ( 485c1e...564e65 )
by
unknown
03:26
created

MediaController::downloadAction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 0
cts 0
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
crap 2
1
<?php
2
3
namespace MediaMonks\SonataMediaBundle\Controller;
4
5
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
6
use Symfony\Component\HttpFoundation\RedirectResponse;
7
use Symfony\Component\HttpFoundation\Request;
8
use Symfony\Component\HttpFoundation\StreamedResponse;
9
10
class MediaController extends Controller
11
{
12
    /**
13
     * @param Request $request
14
     * @param int $id
15
     * @param int $width
16
     * @param int $height
17
     * @return RedirectResponse
18
     */
19
    public function imageRedirectAction(Request $request, $id, $width, $height)
20
    {
21
        $media = $this->getDoctrine()->getManager()->find('MediaMonksSonataMediaBundle:Media', $id);
22
23
        return $this->get('mediamonks.sonata_media.utility.image')->getRedirectResponse($media, $width, $height, $request->query->all());
24
    }
25
26
    /**
27
     * @param Request $request
28
     * @param $id
29
     * @return StreamedResponse
30
     */
31
    public function downloadAction(Request $request, $id)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

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

Loading history...
32
    {
33
        $media = $this->getDoctrine()->getManager()->find('MediaMonksSonataMediaBundle:Media', $id);
34
35
        return $this->get('mediamonks.sonata_media.utility.download')->getStreamedResponse($media);
36
    }
37
}
38