Completed
Push — navigation ( b9a6ad )
by Arnaud
16:10
created

Collection   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 5
dl 0
loc 21
rs 10
c 1
b 1
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 3 1
A __isset() 0 7 2
1
<?php
2
/**
3
 * This file is part of the Cecil/Cecil package.
4
 *
5
 * Copyright (c) Arnaud Ligny <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Cecil\Collection\Menu;
12
13
use Cecil\Collection\Collection as CecilCollection;
14
use Cecil\Collection\ItemInterface;
15
16
/**
17
 * Class Collection.
18
 */
19
class Collection extends CecilCollection
20
{
21
    /**
22
     * Return a Menu collection.
23
     * {@inheritdoc}
24
     */
25
    public function get(string $id): ItemInterface
26
    {
27
        return parent::get($id);
28
    }
29
30
    /**
31
     * Checks if menu exists.
32
     */
33
    public function __isset(string $id): bool
34
    {
35
        if ($this->has($id)) {
36
            return true;
37
        }
38
39
        throw new \Exception(\sprintf('Menu "%s" not found', $id));
40
    }
41
}
42