Code Duplication    Length = 12-12 lines in 2 locations

src/Collection.php 2 locations

@@ 79-90 (lines=12) @@
76
     * @param string|callable $fn '$_ > 100'
77
     * @return $this
78
     */
79
    public function filter($fn)
80
    {
81
        $this->is_array = false;
82
        if (is_callable($fn)) {
83
            $fn_name = '_fn' . $this->fn_cnt++;
84
            $this->vars[$fn_name] = $fn;
85
            $this->ops[] = 'if (!$' . $fn_name . '($_)) continue;';
86
        } else {
87
            $this->ops[] = 'if (!(' . $fn . ')) continue;';
88
        }
89
        return $this;
90
    }
91
92
    /**
93
     * @param string|callable $fn '$_ * 2'
@@ 96-107 (lines=12) @@
93
     * @param string|callable $fn '$_ * 2'
94
     * @return $this
95
     */
96
    public function map($fn)
97
    {
98
        $this->is_array = false;
99
        if (is_callable($fn)) {
100
            $fn_name = '_fn' . $this->fn_cnt++;
101
            $this->vars[$fn_name] = $fn;
102
            $this->ops[] = '$_ = $' . $fn_name . '($_);';
103
        } else {
104
            $this->ops[] = '$_ = ' . $fn . ';';
105
        }
106
        return $this;
107
    }
108
109
    /**
110
     * @param string[] column