LocaleCollection   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 32
c 0
b 0
f 0
wmc 2
lcom 0
cbo 2
ccs 4
cts 4
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 4 1
A addOne() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Arcanedev\LaravelLang\Entities;
6
7
use Arcanedev\LaravelLang\Contracts\Entities\Locale as LocaleContract;
8
use Illuminate\Support\Collection;
9
10
/**
11
 * Class     LocaleCollection
12
 *
13
 * @author   ARCANEDEV <[email protected]>
14
 */
15
class LocaleCollection extends Collection
16
{
17
    /* -----------------------------------------------------------------
18
     |  Main Methods
19
     | -----------------------------------------------------------------
20
     */
21
22
    /**
23
     * Get an item from the collection by key.
24
     *
25
     * @param  string  $key
26
     * @param  mixed   $default
27
     *
28
     * @return \Arcanedev\LaravelLang\Contracts\Entities\Locale|mixed
29
     */
30 60
    public function get($key, $default = null)
31
    {
32 60
        return parent::get($key, $default);
33
    }
34
35
    /**
36
     * Add a locale to collection.
37
     *
38
     * @param  \Arcanedev\LaravelLang\Contracts\Entities\Locale  $local
39
     *
40
     * @return $this
41
     */
42 132
    public function addOne(LocaleContract $local)
43
    {
44 132
        return $this->put($local->getKey(), $local);
45
    }
46
}
47