Code Duplication    Length = 19-22 lines in 3 locations

src/QueryBuilderRequest.php 2 locations

@@ 113-134 (lines=22) @@
110
        return collect($sortParts)->filter();
111
    }
112
113
    protected function getFilterValue($value)
114
    {
115
        if (is_array($value)) {
116
            return collect($value)->map(function ($valueValue) {
117
                return $this->getFilterValue($valueValue);
118
            })->all();
119
        }
120
121
        if (Str::contains($value, ',')) {
122
            return explode(',', $value);
123
        }
124
125
        if ($value === 'true') {
126
            return true;
127
        }
128
129
        if ($value === 'false') {
130
            return false;
131
        }
132
133
        return $value;
134
    }
135
136
    protected function getSearchValue($value)
137
    {
@@ 136-157 (lines=22) @@
133
        return $value;
134
    }
135
136
    protected function getSearchValue($value)
137
    {
138
        if (is_array($value)) {
139
            return collect($value)->map(function ($valueValue) {
140
                return $this->getSearchValue($valueValue);
141
            })->all();
142
        }
143
144
        if (Str::contains($value, ',')) {
145
            return explode(',', $value);
146
        }
147
148
        if ($value === 'true') {
149
            return true;
150
        }
151
152
        if ($value === 'false') {
153
            return false;
154
        }
155
156
        return $value;
157
    }
158
}
159

src/QueryBuilderServiceProvider.php 1 location

@@ 68-86 (lines=19) @@
65
66
            $filters = collect($filterParts);
67
68
            $filtersMapper = function ($value) {
69
                if (is_array($value)) {
70
                    return collect($value)->map($this->bindTo($this))->all();
71
                }
72
73
                if (Str::contains($value, ',')) {
74
                    return explode(',', $value);
75
                }
76
77
                if ($value === 'true') {
78
                    return true;
79
                }
80
81
                if ($value === 'false') {
82
                    return false;
83
                }
84
85
                return $value;
86
            };
87
88
            $filters = $filters->map($filtersMapper->bindTo($filtersMapper));
89