FileUtility   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Test Coverage

Coverage 75%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 13
ccs 3
cts 4
cp 0.75
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A getAbsoluteFilePath() 0 7 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ApacheSolrForTypo3\Tika\Utility;
6
7
/**
8
 * This file is part of the TYPO3 CMS project.
9
 *
10
 * It is free software; you can redistribute it and/or modify it under
11
 * the terms of the GNU General Public License, either version 2
12
 * of the License, or any later version.
13
 *
14
 * For the full copyright and license information, please read the
15
 * LICENSE.txt file that was distributed with this source code.
16
 *
17
 * The TYPO3 project - inspiring people to share!
18
 */
19
20
use TYPO3\CMS\Core\Utility\GeneralUtility;
21
22
/**
23
 * Class FileUtility
24
 */
25
class FileUtility
26
{
27
    /**
28
     * @param string $path
29
     * @return string
30
     */
31 13
    public static function getAbsoluteFilePath(string $path): string
32
    {
33 13
        if (substr($path, 0, 1) === '/') {
34
            // if the path start with a "/" we thread it as absolute
35 13
            return $path;
36
        }
37
        return GeneralUtility::getFileAbsFileName($path);
38
    }
39
}
40