Completed
Push — master ( b30e53...9fbf6c )
by Victor
01:55
created

TextFileHandler   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 1 Features 2
Metric Value
wmc 2
c 2
b 1
f 2
lcom 0
cbo 2
dl 0
loc 25
ccs 0
cts 10
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A loadFileFromPath() 0 5 1
A writeFile() 0 5 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: victor
5
 * Date: 10/04/16
6
 * Time: 23:46
7
 */
8
9
namespace LazyEight\DiTesto;
10
11
12
use LazyEight\DiTesto\ValueObject\FileLocation;
13
use LazyEight\DiTesto\ValueObject\TextFile\TextFile;
14
15
class TextFileHandler
16
{
17
    /**
18
     * Load file from disk
19
     *
20
     * @throws InvalidFileLocationException
21
     * @throws InvalidFileTypeException
22
     * @param FileLocation $location
23
     * @return TextFile
24
     */
25
    public function loadFileFromPath(FileLocation $location)
26
    {
27
        $fileLoader = new TextFileLoader($location);
28
        return $fileLoader->loadFile();
29
    }
30
31
    /**
32
     * @param TextFile $file
33
     */
34
    public function writeFile(TextFile $file)
35
    {
36
        $fileWriter = new TextFileWriter($file);
37
        $fileWriter->writeFile();
38
    }
39
}