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

Base::correct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 6
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 10
rs 10
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\Support\Facades\Helpers\Ables\Arrayable;
24
use Helldar\Support\Facades\Helpers\Filesystem\File;
25
26
abstract class Base implements Filesystem
27
{
28
    protected function doesntExists(string $path): bool
29
    {
30
        return ! File::exists($path);
31
    }
32
33
    protected function correct(array $items): array
34
    {
35
        $callback = static function ($value) {
36
            return stripslashes($value);
37
        };
38
39
        return Arrayable::of($items)
40
            ->map($callback, true)
41
            ->renameKeys($callback)
42
            ->get();
43
    }
44
}
45