Completed
Push — develop ( 0d976a...21f0a6 )
by ARCANEDEV
13:35 queued 12:35
created

LocaleCollection::get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 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
 * @package  Arcanedev\LaravelLang\Entities
14
 * @author   ARCANEDEV <[email protected]>
15
 */
16
class LocaleCollection extends Collection
17
{
18
    /* -----------------------------------------------------------------
19
     |  Main Methods
20
     | -----------------------------------------------------------------
21
     */
22
23
    /**
24
     * Get an item from the collection by key.
25
     *
26
     * @param  string  $key
27
     * @param  mixed   $default
28
     *
29
     * @return \Arcanedev\LaravelLang\Contracts\Entities\Locale|mixed
30
     */
31 40
    public function get($key, $default = null)
32
    {
33 40
        return parent::get($key, $default);
34
    }
35
36
    /**
37
     * Add a locale to collection.
38
     *
39
     * @param  \Arcanedev\LaravelLang\Contracts\Entities\Locale  $local
40
     *
41
     * @return $this
42
     */
43 88
    public function addOne(LocaleContract $local)
44
    {
45 88
        return $this->put($local->getKey(), $local);
46
    }
47
}
48