Completed
Pull Request — master (#5)
by Carlos C
13:10
created

Set   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

1 Method

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