Code Duplication    Length = 17-22 lines in 4 locations

sources/GenericCollections/Collection.php 1 location

@@ 16-32 (lines=17) @@
13
 *
14
 * @package GenericCollections
15
 */
16
class Collection extends AbstractCollection
17
{
18
    use ElementTypeProperty;
19
    use OptionsProperty;
20
21
    /**
22
     * @param string $elementType
23
     * @param array $elements
24
     * @param int $options
25
     */
26
    public function __construct($elementType, array $elements = [], $options = 0)
27
    {
28
        $this->options = new Options($options);
29
        $this->elementType = new TypeProperty($elementType, $this->options->optionAllowNullMembers());
30
        $this->addAll($elements);
31
    }
32
}
33

sources/GenericCollections/Deque.php 1 location

@@ 25-42 (lines=18) @@
22
 *
23
 * @package GenericCollections
24
 */
25
class Deque extends AbstractDeque
26
{
27
    use ElementTypeProperty;
28
    use OptionsProperty;
29
30
    /**
31
     * @param string $elementType
32
     * @param array $elements
33
     * @param int $options
34
     */
35
    public function __construct($elementType, array $elements = [], $options = 0)
36
    {
37
        $this->options = new Options($options);
38
        $this->elementType = new TypeProperty($elementType, $this->optionAllowNullMembers());
39
        $this->createStorageObject();
40
        $this->addAll($elements);
41
    }
42
}
43

sources/GenericCollections/Queue.php 1 location

@@ 23-44 (lines=22) @@
20
 *
21
 * @package GenericCollections
22
 */
23
class Queue extends AbstractQueue
24
{
25
    use ElementTypeProperty;
26
    use OptionsProperty;
27
28
    /**
29
     * Generic collection
30
     *
31
     * example: `new Collection(Foo::class, [new Foo(), new Foo()]`
32
     *
33
     * @param string $elementType
34
     * @param array $elements
35
     * @param int $options
36
     */
37
    public function __construct($elementType, array $elements = [], $options = 0)
38
    {
39
        $this->options = new Options($options);
40
        $this->elementType = new TypeProperty($elementType, $this->optionAllowNullMembers());
41
        $this->createStorageObject();
42
        $this->addAll($elements);
43
    }
44
}
45

sources/GenericCollections/Stack.php 1 location

@@ 24-41 (lines=18) @@
21
 *
22
 * @package GenericCollections
23
 */
24
class Stack extends AbstractStack implements StackInterface
25
{
26
    use ElementTypeProperty;
27
    use OptionsProperty;
28
29
    /**
30
     * @param string $elementType
31
     * @param array $elements
32
     * @param int $options
33
     */
34
    public function __construct($elementType, array $elements = [], $options = 0)
35
    {
36
        $this->options = new Options($options);
37
        $this->elementType = new TypeProperty($elementType, $this->optionAllowNullMembers());
38
        $this->createStorageObject();
39
        $this->addAll($elements);
40
    }
41
}
42