Completed
Pull Request — master (#1205)
by Rafał
10:14
created

RedirectableUrlMatcher   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 2
dl 0
loc 15
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A redirect() 0 12 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Superdesk Web Publisher Content Bundle.
7
 *
8
 * Copyright 2021 Sourcefabric z.ú. and contributors.
9
 *
10
 * For the full copyright and license information, please see the
11
 * AUTHORS and LICENSE files distributed with this source code.
12
 *
13
 * @copyright 2021 Sourcefabric z.ú
14
 * @license http://www.superdesk.org/license
15
 */
16
17
18
namespace SWP\Bundle\ContentBundle\Routing;
19
20
use Symfony\Component\Routing\Matcher\RedirectableUrlMatcher as BaseRedirectableUrlMatcher;
21
22
class RedirectableUrlMatcher extends BaseRedirectableUrlMatcher
23
{
24
    public function redirect($path, $route, $scheme = null): array
25
    {
26
        return [
27
            '_controller' => 'Symfony\\Bundle\\FrameworkBundle\\Controller\\RedirectController::urlRedirectAction',
28
            'path' => $path,
29
            'permanent' => true,
30
            'scheme' => $scheme,
31
            'httpPort' => $this->context->getHttpPort(),
32
            'httpsPort' => $this->context->getHttpsPort(),
33
            '_route' => $route,
34
        ];
35
    }
36
}
37