Set   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 2
1
<?php
2
namespace GenericCollections;
3
4
/**
5
 * Generic set implementation
6
 *
7
 * A set is the same as a collection but can't contain duplicated values
8
 *
9
 * Options:
10
 * - Defaults: not allow nulls, identical comparisons
11
 * - It is not possible to allow duplicates, use a Collection instead
12
 * - If allow null elements is enabled only 1 element can be null
13
 *
14
 * @package GenericCollections
15
 */
16
class Set extends Collection
17
{
18
    /**
19
     * @param string $elementType
20
     * @param array $elements
21
     * @param int $options Options::COMPARISON_EQUAL
22
     */
23 3
    public function __construct($elementType, array $elements = [], $options = Options::UNIQUE_VALUES)
24
    {
25
        // force Options::UNIQUE_VALUES
26 3
        if (is_int($options)) {
27 3
            $options = $options | Options::UNIQUE_VALUES;
28
        }
29 3
        parent::__construct($elementType, $elements, $options);
30 3
    }
31
}
32