Code Duplication    Length = 11-12 lines in 2 locations

src/Arrayy.php 2 locations

@@ 2186-2196 (lines=11) @@
2183
     * @psalm-return static<TKey,T>
2184
     * @psalm-mutation-free
2185
     */
2186
    public function each(\Closure $closure): self
2187
    {
2188
        // init
2189
        $array = [];
2190
2191
        foreach ($this->getGenerator() as $key => $value) {
2192
            $array[$key] = $closure($value, $key);
2193
        }
2194
2195
        return static::create(
2196
            $array,
2197
            $this->iteratorClass,
2198
            false
2199
        );
@@ 5135-5146 (lines=12) @@
5132
     * @psalm-return static<TKey,T>
5133
     * @psalm-mutation-free
5134
     */
5135
    public function reject(\Closure $closure): self
5136
    {
5137
        // init
5138
        $filtered = [];
5139
5140
        foreach ($this->getGenerator() as $key => $value) {
5141
            if (!$closure($value, $key)) {
5142
                $filtered[$key] = $value;
5143
            }
5144
        }
5145
5146
        return static::create(
5147
            $filtered,
5148
            $this->iteratorClass,
5149
            false