Completed
Push — master ( f47b5a...e55be9 )
by Roberto
15:23 queued 13:17
created

FilesFolders::init()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 14
ccs 0
cts 14
cp 0
rs 9.4285
cc 1
eloc 9
nc 1
nop 1
crap 2
1
<?php
2
3
namespace NFePHP\Esfinge\Files;
4
5
use League\Flysystem\Filesystem;
6
use League\Flysystem\Adapter\Local;
7
8
class FilesFolders
9
{
10
    protected static $filesystem;
11
    
12
    protected static function init($path)
13
    {
14
        $adapter = new Local($path, LOCK_EX, Local::DISALLOW_LINKS, [
15
            'file' => [
16
                'public' => 0744,
17
                'private' => 0700
18
            ],
19
            'dir' => [
20
                'public' => 0755,
21
                'private' => 0700
22
            ]
23
        ]);
24
        self::$filesystem = new Filesystem($adapter);
25
    }
26
    
27
    public static function save($path, $filename, $contents)
28
    {
29
        self::init($path);
30
        self::$filesystem->put($filename, $contents, ['visibility' => 'public']);
31
    }
32
}
33