SlimRouter::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 23

Duplication

Lines 16
Ratio 69.57 %

Code Coverage

Tests 5
CRAP Score 1.2657

Importance

Changes 0
Metric Value
dl 16
loc 23
ccs 5
cts 14
cp 0.357
rs 9.552
c 0
b 0
f 0
cc 1
nc 1
nop 3
crap 1.2657
1
<?php
2
namespace Germania\Favicons;
3
4
use Twig_Environment;
5
use Slim\App;
6
use Psr\Http\Message\ServerRequestInterface as Request;
7
use Psr\Http\Message\ResponseInterface as Response;
8
9
class SlimRouter
10
{
11 1
    public function __construct( App $app, Twig_Environment $twig, $favicon_data)
12
    {
13 View Code Duplication
        $app->get('/browserconfig.xml', function (Request $request, Response $response) use ($twig, $favicon_data) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
14
            $output = $twig->render('favicons.browserconfig.xml.tpl', $favicon_data);
15
16
            $newResponse = $response->withHeader('Content-type', 'application/xml');
17
            $newResponse->getBody()->write($output);
18
19
            return $newResponse;
20 1
        });
21
22
23 1 View Code Duplication
        $app->get('/manifest.json', function (Request $request, Response $response) use ($twig, $favicon_data) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
24
            $output = $twig->render('favicons.manifest.json.tpl', $favicon_data);
25
26
            $newResponse = $response->withHeader('Content-type', 'application/manifest+json');
27
            $newResponse->getBody()->write($output);
28
29
            return $newResponse;
30 1
        });
31
32
33 1
    }
34
}
35