UrlBuilder   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 17
ccs 0
cts 7
cp 0
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A getInfoModuleUrl() 0 8 2
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
/**
27
 * @internal since v9.2.5
28
 */
29
class UrlBuilder
30
{
31
    /**
32
     * Returns the URL to the current module, including $_GET['id'].
33
     *
34
     * @param array $uriParameters optional parameters to add to the URL
35
     *
36
     * @throws \TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException
37
     */
38
    public static function getInfoModuleUrl(array $uriParameters = []): Uri
39
    {
40
        if (GeneralUtility::_GP('id')) {
41
            $uriParameters['id'] = GeneralUtility::_GP('id');
42
        }
43
        /** @var UriBuilder $uriBuilder */
44
        $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
45
        return $uriBuilder->buildUriFromRoute('web_info', $uriParameters);
46
    }
47
}
48