Passed
Push — 10.x ( 322bee...0db173 )
by Andrey
11:12
created

Manager   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 20
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A load() 0 3 1
A store() 0 3 1
A filesystem() 0 5 2
1
<?php
2
3
/*
4
 * This file is part of the "andrey-helldar/laravel-lang-publisher" project.
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 *
9
 * @author Andrey Helldar <[email protected]>
10
 *
11
 * @copyright 2021 Andrey Helldar
12
 *
13
 * @license MIT
14
 *
15
 * @see https://github.com/andrey-helldar/laravel-lang-publisher
16
 */
17
18
declare(strict_types=1);
19
20
namespace Helldar\LaravelLangPublisher\Support\Filesystem;
21
22
use Helldar\Contracts\Support\Filesystem;
23
use Helldar\LaravelLangPublisher\Concerns\Has;
24
use Helldar\Support\Concerns\Resolvable;
25
26
class Manager
27
{
28
    use Resolvable;
29
    use Has;
30
31
    public function load(string $path): array
32
    {
33
        return $this->filesystem($path)->load($path);
34
    }
35
36
    public function store(string $path, array $content): void
37
    {
38
        $this->filesystem($path)->store($path, $content);
39
    }
40
41
    protected function filesystem(string $path): Filesystem
42
    {
43
        return $this->hasJson($path)
44
            ? static::resolveInstance(Json::class)
45
            : static::resolveInstance(Php::class);
46
    }
47
}
48