Passed
Push — main ( fac73b...8d20c8 )
by Andrey
27:54 queued 25:43
created

Arrayable   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 22
ccs 9
cts 9
cp 1
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A sort() 0 3 1
A sortAndMerge() 0 5 1
A mergeArray() 0 3 1
A combine() 0 3 1
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\Concerns;
21
22
use Helldar\Support\Facades\Helpers\Arr;
23
24
trait Arrayable
25
{
26 85
    protected function combine(array ...$arrays): array
27
    {
28 85
        return Arr::combine(...$arrays);
29
    }
30
31 85
    protected function mergeArray(array ...$arrays): array
32
    {
33 85
        return Arr::merge(...$arrays);
34
    }
35
36 85
    protected function sort(array $array): array
37
    {
38 85
        return Arr::ksort($array);
39
    }
40
41 85
    protected function sortAndMerge(array ...$arrays): array
42
    {
43 85
        $array = $this->mergeArray(...$arrays);
44
45 85
        return $this->sort($array);
46
    }
47
}
48