Completed
Push — master ( 0842cd...0b5524 )
by ARCANEDEV
07:12
created

SitemapItemCollection   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 34
wmc 2
lcom 0
cbo 2
ccs 5
cts 5
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A addItem() 0 6 1
A get() 0 4 1
1
<?php namespace Arcanedev\LaravelSitemap\Entities;
2
3
use Arcanedev\Support\Collection;
4
5
/**
6
 * Class     SitemapItemCollection
7
 *
8
 * @package  Arcanedev\LaravelSitemap\Entities
9
 * @author   ARCANEDEV <[email protected]>
10
 */
11
class SitemapItemCollection extends Collection
12
{
13
    /* ------------------------------------------------------------------------------------------------
14
     |  Main Functions
15
     | ------------------------------------------------------------------------------------------------
16
     */
17
    /**
18
     * Add a sitemap item to the collection.
19
     *
20
     * @param  array  $params
21
     * @param  bool   $escape
22
     *
23
     * @return self
24
     */
25 16
    public function addItem(array $params, $escape = true)
26
    {
27 16
        $this->push(SitemapItem::make($params, $escape));
28
29 16
        return $this;
30
    }
31
32
    /**
33
     * Get a sitemap item from the collection by key.
34
     *
35
     * @param  mixed  $key
36
     * @param  mixed  $default
37
     *
38
     * @return \Arcanedev\LaravelSitemap\Entities\SitemapItem|null
39
     */
40 16
    public function get($key, $default = null)
41
    {
42 16
        return parent::get($key, $default);
43
    }
44
}
45