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

FilesFolders   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 14 1
A save() 0 5 1
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