Collection::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 3
crap 1
1
<?php
2
namespace GenericCollections;
3
4
use GenericCollections\Abstracts\AbstractCollection;
5
use GenericCollections\Traits\ElementTypeProperty;
6
use GenericCollections\Traits\OptionsProperty;
7
use GenericCollections\Utils\TypeProperty;
8
9
/**
10
 * Generic collection implementation
11
 *
12
 * Options:
13
 * - Defaults: not allow nulls, allow duplicates, identical comparisons
14
 *
15
 * @package GenericCollections
16
 */
17
class Collection extends AbstractCollection
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
18
{
19
    use ElementTypeProperty;
20
    use OptionsProperty;
21
22
    /**
23
     * @param string $elementType
24
     * @param array $elements
25
     * @param int $options
26
     */
27 31
    public function __construct($elementType, array $elements = [], $options = 0)
28
    {
29 31
        $this->options = new Options($options);
30 31
        $this->elementType = new TypeProperty($elementType, $this->options->optionAllowNullMembers());
31 31
        $this->addAll($elements);
32 31
    }
33
}
34