Passed
Pull Request — master (#647)
by Tomas Norre
24:27 queued 20:23
created

UrlBuilder   A

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
use TYPO3\CMS\Backend\Routing\UriBuilder;
8
use TYPO3\CMS\Core\Http\Uri;
9
use TYPO3\CMS\Core\Utility\GeneralUtility;
10
11
class UrlBuilder
12
{
13
    /**
14
     * Returns the URL to the current module, including $_GET['id'].
15
     *
16
     * @param array $uriParameters optional parameters to add to the URL
17
     *
18
     * @throws \TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException
19
     */
20
    public static function getInfoModuleUrl(array $uriParameters = []): Uri
21
    {
22
        if (GeneralUtility::_GP('id')) {
23
            $uriParameters['id'] = GeneralUtility::_GP('id');
24
        }
25
        /** @var UriBuilder $uriBuilder */
26
        $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
27
        return $uriBuilder->buildUriFromRoute('web_info', $uriParameters);
28
    }
29
}
30