Code Duplication    Length = 10-11 lines in 4 locations

src/TypedListTrait.php 2 locations

@@ 89-98 (lines=10) @@
86
        $this->compositeVector = new Vector($items);
87
    }
88
89
    private function assertItemIndex($index)
90
    {
91
        if (!is_int($index)) {
92
            throw new \Exception(sprintf(
93
                'Invalid item-key given to %s. Expected int but was given %s',
94
                static::CLASS,
95
                is_object($index) ? get_class($index) : @gettype($index)
96
            ));
97
        }
98
    }
99
100
    private function assertItemType($item)
101
    {
@@ 100-110 (lines=11) @@
97
        }
98
    }
99
100
    private function assertItemType($item)
101
    {
102
        if (!is_a($item, $this->itemFqcn)) {
103
            throw new \Exception(sprintf(
104
                'Invalid item-type given to %s. Expected %s but was given %s',
105
                static::CLASS,
106
                $this->itemFqcn,
107
                is_object($item) ? get_class($item) : @gettype($item)
108
            ));
109
        }
110
    }
111
112
    private function __clone()
113
    {

src/TypedMapTrait.php 2 locations

@@ 71-80 (lines=10) @@
68
        $this->compositeMap = new Map($items);
69
    }
70
71
    private function assertItemKey($key)
72
    {
73
        if (!is_string($key)) {
74
            throw new \Exception(sprintf(
75
                'Invalid item-key given to %s. Expected string but was given %s',
76
                static::CLASS,
77
                is_object($key) ? get_class($key) : @gettype($key)
78
            ));
79
        }
80
    }
81
82
    private function assertItemType($item)
83
    {
@@ 82-92 (lines=11) @@
79
        }
80
    }
81
82
    private function assertItemType($item)
83
    {
84
        if (!is_a($item, $this->itemFqcn)) {
85
            throw new \Exception(sprintf(
86
                'Invalid item-type given to %s. Expected %s but was given %s',
87
                static::CLASS,
88
                $this->itemFqcn,
89
                is_object($item) ? get_class($item) : @gettype($item)
90
            ));
91
        }
92
    }
93
94
    public function __clone()
95
    {