Passed
Pull Request — master (#647)
by Tomas Norre
18:58 queued 14:21
created

UrlBuilder::getInfoModuleUrl()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 8
ccs 0
cts 7
cp 0
crap 6
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AOE\Crawler\Backend\Helper;
6
7
/*
8
 * (c) 2020 AOE GmbH <[email protected]>
9
 *
10
 * This file is part of the TYPO3 Crawler Extension.
11
 *
12
 * It is free software; you can redistribute it and/or modify it under
13
 * the terms of the GNU General Public License, either version 2
14
 * of the License, or any later version.
15
 *
16
 * For the full copyright and license information, please read the
17
 * LICENSE.txt file that was distributed with this source code.
18
 *
19
 * The TYPO3 project - inspiring people to share!
20
 */
21
22
use TYPO3\CMS\Backend\Routing\UriBuilder;
23
use TYPO3\CMS\Core\Http\Uri;
24
use TYPO3\CMS\Core\Utility\GeneralUtility;
25
26
class UrlBuilder
27
{
28
    /**
29
     * Returns the URL to the current module, including $_GET['id'].
30
     *
31
     * @param array $uriParameters optional parameters to add to the URL
32
     *
33
     * @throws \TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException
34
     */
35
    public static function getInfoModuleUrl(array $uriParameters = []): Uri
36
    {
37
        if (GeneralUtility::_GP('id')) {
38
            $uriParameters['id'] = GeneralUtility::_GP('id');
39
        }
40
        /** @var UriBuilder $uriBuilder */
41
        $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
42
        return $uriBuilder->buildUriFromRoute('web_info', $uriParameters);
43
    }
44
}
45