Completed
Push — master ( 8bf9d5...75d86a )
by ARCANEDEV
18s
created

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