Passed
Push — master ( 4ac39c...ddccf7 )
by Alain
03:15
created

URICollection   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A fromFinder() 0 6 1
1
<?php
2
/**
3
 * Bright Nucleus View Component.
4
 *
5
 * @package   BrightNucleus\View
6
 * @author    Alain Schlesser <[email protected]>
7
 * @license   MIT
8
 * @link      http://www.brightnucleus.com/
9
 * @copyright 2016 Alain Schlesser, Bright Nucleus
10
 */
11
12
namespace BrightNucleus\View\Location;
13
14
use Doctrine\Common\Collections\ArrayCollection;
15
use Symfony\Component\Finder\Finder;
16
17
/**
18
 * Class URICollection.
19
 *
20
 * @since   0.1.1
21
 *
22
 * @package BrightNucleus\View\Location
23
 * @author  Alain Schlesser <[email protected]>
24
 */
25
class URICollection extends ArrayCollection
26
{
27
28
    /**
29
     * Create a new URICollection from a Symfony Finder instance.
30
     *
31
     * @since 0.1.3
32
     *
33
     * @param Finder $finder The Finder instance to create the URI collection from.
34
     *
35
     * @return static New URICollection instance.
36
     */
37
    public static function fromFinder(Finder $finder)
38
    {
39
        $elements = array_keys(iterator_to_array($finder));
40
41
        return new static($elements);
42
    }
43
}
44