FileSystem::write()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
rs 9.4286
cc 2
eloc 5
nc 2
nop 2
1
<?php
2
/**
3
 * Author: Nil Portugués Calderó <[email protected]>
4
 * Date: 12/18/15
5
 * Time: 11:00 PM.
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace NilPortugues\SchemaOrg\Generator\FileSystem;
12
13
/**
14
 * Class FileSystem.
15
 */
16
class FileSystem implements FileSystemInterface
17
{
18
    /**
19
     * @param $filePath
20
     * @param $contents
21
     */
22
    public function write($filePath, $contents)
23
    {
24
        $path = pathinfo($filePath, PATHINFO_DIRNAME);
25
26
        if (!file_exists($path)) {
27
            mkdir($path, 0755, true);
28
        }
29
30
        file_put_contents($filePath, $contents);
31
    }
32
}
33