Issues (25)

src/Constraints/Like.php (1 issue)

Labels
Severity
1
<?php
2
/**
3
 * Created by enea dhack - 03/01/2020 17:00.
4
 */
5
6
namespace Vaened\Searcher\Constraints;
7
8
use Illuminate\Database\Eloquent\Builder;
9
use Vaened\Searcher\Constraint;
10
use Vaened\Searcher\Keywords\Wildcard;
0 ignored issues
show
The type Vaened\Searcher\Keywords\Wildcard was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
12
class Like implements Constraint
13
{
14
    private string $value;
15
16
    private string $column;
17
18
    private ?Wildcard $wildcard;
19
20
    public function __construct(string $value, string $column, ?Wildcard $wildcard = null)
21
    {
22
        $this->value = $value;
23
        $this->column = $column;
24
        $this->wildcard = $wildcard;
25
    }
26
27
    public function condition(Builder $builder): Builder
28
    {
29
        $wildcard = $this->wildcard ?: Wildcard::RIGHT();
30
        return $builder->where($this->column, 'LIKE', $wildcard->apply($this->value));
31
    }
32
}
33