Completed
Push — master ( 88b284...7974f9 )
by Song
15s
created

LeftLike   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 26
loc 26
rs 10
c 0
b 0
f 0
wmc 4
lcom 1
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A condition() 16 16 4

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace Encore\Admin\Grid\Filter;
4
5 View Code Duplication
class LeftLike extends AbstractFilter
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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);
0 ignored issues
show
Deprecated Code introduced by
The function array_get() has been deprecated with message: Arr::get() should be used directly instead. Will be removed in Laravel 5.9.

This function has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed from the class and what other function to use instead.

Loading history...
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