AbstractFileWriter   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 6
dl 0
loc 28
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A createDirectory() 0 7 2
1
<?php
2
3
/**
4
 * MIT License
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace SprykerEco\Zed\FactFinderSdk\Business\Writer;
9
10
abstract class AbstractFileWriter
11
{
12
    /**
13
     * @var string
14
     */
15
    protected $fileName;
16
17
    /**
18
     * @param string $filePath
19
     * @param array $data
20
     * @param bool $append
21
     *
22
     * @return void
23
     */
24
    abstract public function write($filePath, $data, $append = false);
25
26
    /**
27
     * @param string $fileName
28
     *
29
     * @return void
30
     */
31
    protected function createDirectory($fileName)
32
    {
33
        $pathInfo = pathinfo($fileName);
34
        $directory = $pathInfo['dirname'];
35
36
        if (!file_exists($directory)) {
37
            mkdir($directory);
38
        }
39
    }
40
}
41