Code Duplication    Length = 26-26 lines in 3 locations

src/Grid/Filter/Ilike.php 1 location

@@ 5-30 (lines=26) @@
2
3
namespace Encore\Admin\Grid\Filter;
4
5
class Ilike extends AbstractFilter
6
{
7
    /**
8
     * Get condition of this filter.
9
     *
10
     * @param array $inputs
11
     *
12
     * @return array|mixed|void
13
     */
14
    public function condition($inputs)
15
    {
16
        $value = array_get($inputs, $this->column);
17
18
        if (is_array($value)) {
19
            $value = array_filter($value);
20
        }
21
22
        if (is_null($value) || empty($value)) {
23
            return;
24
        }
25
26
        $this->value = $value;
27
28
        return $this->buildCondition($this->column, 'ilike', "%{$this->value}%");
29
    }
30
}
31

src/Grid/Filter/Like.php 1 location

@@ 5-30 (lines=26) @@
2
3
namespace Encore\Admin\Grid\Filter;
4
5
class Like extends AbstractFilter
6
{
7
    /**
8
     * Get condition of this filter.
9
     *
10
     * @param array $inputs
11
     *
12
     * @return array|mixed|void
13
     */
14
    public function condition($inputs)
15
    {
16
        $value = array_get($inputs, $this->column);
17
18
        if (is_array($value)) {
19
            $value = array_filter($value);
20
        }
21
22
        if (is_null($value) || empty($value)) {
23
            return;
24
        }
25
26
        $this->value = $value;
27
28
        return $this->buildCondition($this->column, 'like', "%{$this->value}%");
29
    }
30
}
31

src/Grid/Filter/LeftLike.php 1 location

@@ 5-30 (lines=26) @@
2
3
namespace Encore\Admin\Grid\Filter;
4
5
class LeftLike extends AbstractFilter
6
{
7
    /**
8
     * Get condition of this filter.
9
     *
10
     * @param array $inputs
11
     *
12
     * @return array|mixed|void
13
     */
14
    public function condition($inputs)
15
    {
16
        $value = array_get($inputs, $this->column);
17
18
        if (is_array($value)) {
19
            $value = array_filter($value);
20
        }
21
22
        if (is_null($value) || empty($value)) {
23
            return;
24
        }
25
26
        $this->value = $value;
27
28
        return $this->buildCondition($this->column, 'like', "{$this->value}%");
29
    }
30
}
31