Passed
Push — main ( 55f929...127e84 )
by Andrey
161:41 queued 158:10
created

Manager   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 27
ccs 11
cts 11
cp 1
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A load() 0 5 1
A store() 0 5 1
A filesystem() 0 7 2
1
<?php
2
3
namespace Helldar\LaravelLangPublisher\Services\Filesystem;
4
5
use Helldar\LaravelLangPublisher\Concerns\Containable;
6
use Helldar\LaravelLangPublisher\Concerns\Contains;
7
use Helldar\LaravelLangPublisher\Concerns\Logger;
8
use Helldar\LaravelLangPublisher\Contracts\Filesystem as Contract;
9
10
final class Manager implements Contract
11
{
12
    use Containable;
13
    use Contains;
14
    use Logger;
0 ignored issues
show
Bug introduced by
The trait Helldar\LaravelLangPublisher\Concerns\Logger requires the property $output which is not provided by Helldar\LaravelLangPubli...ices\Filesystem\Manager.
Loading history...
15
16 11
    public function load(string $path): array
17
    {
18 11
        $this->log('Loading data from an array: ' . $path);
19
20 11
        return $this->filesystem($path)->load($path);
21
    }
22
23 11
    public function store(string $path, array $content)
24
    {
25 11
        $this->log('Saving an array to a file: ' . $path);
26
27 11
        return $this->filesystem($path)->store($path, $content);
28
    }
29
30 11
    protected function filesystem(string $path): Contract
31
    {
32 11
        $this->log('Getting an object for working with files by the path: ' . $path);
33
34 11
        return $this->isJson($path)
35 11
            ? $this->container(Json::class)
36 11
            : $this->container(Php::class);
37
    }
38
}
39