Builder::orWhereLike()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 2
crap 2
1
<?php
2
3
namespace Ianrizky\Illuminate\Database\Query;
4
5
use Illuminate\Database\Query\Builder as BaseBuilder;
6
7
class Builder extends BaseBuilder
8
{
9
    /**
10
     * Add a basic "where like" clause to the query.
11
     *
12
     * @param  string  $column
13
     * @param  mixed   $value
14
     * @param  string  $boolean
15
     * @return $this
16
     */
17
    public function whereLike($column, $value, $boolean = 'and')
18
    {
19
        return parent::where($column, 'like', $value, $boolean);
20
    }
21
22
    /**
23
     * Add an "or where like" clause to the query.
24
     *
25
     * @param  string  $column
26
     * @param  mixed   $value
27
     * @return $this
28
     */
29
    public function orWhereLike($column, $value)
30
    {
31
        return $this->whereLike($column, $value, 'or');
32
    }
33
34
    /**
35
     * Add a basic "where like" with prefix "%" clause to the query.
36
     *
37
     * @param  string  $column
38
     * @param  mixed   $value
39
     * @param  string  $boolean
40
     * @return $this
41
     */
42
    public function whereLikeEnd($column, $value, $boolean = 'and')
43
    {
44
        return $this->whereLike($column, sprintf('%%%s', $value), $boolean);
45
    }
46
47
    /**
48
     * Add an "or where like" with prefix "%" clause to the query.
49
     *
50
     * @param  string  $column
51
     * @param  mixed   $value
52
     * @return $this
53
     */
54
    public function orWhereLikeEnd($column, $value)
55
    {
56
        return $this->whereLikeEnd($column, $value, 'or');
57
    }
58
59
    /**
60
     * Add a basic "where like" with postfix "%" clause to the query.
61
     *
62
     * @param  string  $column
63
     * @param  mixed   $value
64
     * @param  string  $boolean
65
     * @return $this
66
     */
67
    public function whereLikeStart($column, $value, $boolean = 'and')
68
    {
69
        return $this->whereLike($column, sprintf('%s%%', $value), $boolean);
70
    }
71
72
    /**
73
     * Add an "or where like" with postfix "%" clause to the query.
74
     *
75
     * @param  string  $column
76
     * @param  mixed   $value
77
     * @return $this
78
     */
79
    public function orWhereLikeStart($column, $value)
80
    {
81
        return $this->whereLikeStart($column, $value, 'or');
82
    }
83
84
    /**
85
     * Add a basic "where like" with prefix "%" and postfix "%" clause to the query.
86
     *
87
     * @param  string  $column
88
     * @param  mixed   $value
89
     * @param  string  $boolean
90
     * @return $this
91
     */
92
    public function whereLikeAny($column, $value, $boolean = 'and')
93
    {
94
        return $this->whereLike($column, sprintf('%%%s%%', $value), $boolean);
95
    }
96
97
    /**
98
     * Add an "or where like" with prefix "%" and postfix "%" clause to the query.
99
     *
100
     * @param  string  $column
101
     * @param  mixed   $value
102
     * @return $this
103
     */
104
    public function orWhereLikeAny($column, $value)
105
    {
106
        return $this->whereLikeAny($column, $value, 'or');
107
    }
108
}
109