MediaController::faviconAction()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 0
cts 7
cp 0
rs 9.6666
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 1
crap 2
1
<?php
2
/**
3
 * AnimeDb package.
4
 *
5
 * @author    Peter Gribanov <[email protected]>
6
 * @copyright Copyright (c) 2011, Peter Gribanov
7
 * @license   http://opensource.org/licenses/GPL-3.0 GPL v3
8
 */
9
namespace AnimeDb\Bundle\AppBundle\Controller;
10
11
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
12
use Symfony\Component\HttpFoundation\Response;
13
use AnimeDb\Bundle\AppBundle\Service\Downloader;
14
15
class MediaController extends Controller
16
{
17
    /**
18
     * @param string $host
19
     *
20
     * @return Response
21
     */
22
    public function faviconAction($host)
23
    {
24
        $response = new Response();
25
        $response->headers->set('Content-Type', Downloader::FAVICON_MIME);
26
27
        $filename = $this->get('anime_db.downloader')->favicon($host);
28
29
        return $response->setContent(file_get_contents($filename));
30
    }
31
}
32