RepositoryCollection::put()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 2
1
<?php
2
3
namespace App\Satis\Collections;
4
5
use \InvalidArgumentException;
6
use App\Satis\Model\Repository;
7
use Illuminate\Support\Collection;
8
9
/**
10
 * @author Lukas Homza <[email protected]>
11
 */
12
class RepositoryCollection extends Collection {
13
    /**
14
     * Put an item in the collection by key.
15
     *
16
     * @param  mixed  $key
17
     * @param  mixed  $value
18
     * @return $this
19
     */
20
    public function put($key, $value) {
21
        if(!$value instanceof Repository) {
22
            throw new InvalidArgumentException('RepositoryCollection accepts only elements of "Repository" type.');
23
        }
24
25
        return parent::put($key, $value);
26
    }
27
}
28