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

MediaController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 28
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A imageRedirectAction() 0 6 1
A downloadAction() 0 6 1
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