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

FileService   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 4
Bugs 0 Features 2
Metric Value
wmc 2
c 4
b 0
f 2
lcom 0
cbo 2
dl 0
loc 20
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A readFile() 0 8 2
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