Completed
Push — master ( 11f33f...14005b )
by Tim
10:31 queued 07:40
created

FileService::readFile()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 2
Metric Value
dl 0
loc 8
rs 9.4285
c 3
b 0
f 2
cc 2
eloc 4
nc 2
nop 1
1
<?php
2
3
/**
4
 * Class FileService
5
 */
6
7
namespace HDNET\OnpageIntegration\Service;
8
9
use HDNET\Autoloader\Exception;
10
use TYPO3\CMS\Core\Utility\GeneralUtility;
11
12
/**
13
 * Class FileService
14
 */
15
class FileService extends AbstractService
16
{
17
18
    /**
19
     * Returns file content
20
     *
21
     * @param $filePath
22
     *
23
     * @return string
24
     * @throws Exception
25
     */
26
    public function readFile($filePath)
27
    {
28
        if (!is_file($filePath)) {
29
            throw new Exception("File not found!");
30
        }
31
32
        return GeneralUtility::getUrl($filePath);
33
    }
34
}
35