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

TextFileHandler::writeFile()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 5
ccs 0
cts 5
cp 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
crap 2
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
}