Code Duplication    Length = 11-12 lines in 2 locations

src/Arrayy.php 2 locations

@@ 2239-2249 (lines=11) @@
2236
     * @psalm-return static<TKey,T>
2237
     * @psalm-mutation-free
2238
     */
2239
    public function each(\Closure $closure): self
2240
    {
2241
        // init
2242
        $array = [];
2243
2244
        foreach ($this->getGenerator() as $key => $value) {
2245
            $array[$key] = $closure($value, $key);
2246
        }
2247
2248
        return static::create(
2249
            $array,
2250
            $this->iteratorClass,
2251
            false
2252
        );
@@ 5255-5266 (lines=12) @@
5252
     * @psalm-return static<TKey,T>
5253
     * @psalm-mutation-free
5254
     */
5255
    public function reject(\Closure $closure): self
5256
    {
5257
        // init
5258
        $filtered = [];
5259
5260
        foreach ($this->getGenerator() as $key => $value) {
5261
            if (!$closure($value, $key)) {
5262
                $filtered[$key] = $value;
5263
            }
5264
        }
5265
5266
        return static::create(
5267
            $filtered,
5268
            $this->iteratorClass,
5269
            false