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

Arrayable::sortAndMerge()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
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\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