GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Code Duplication    Length = 32-43 lines in 3 locations

src/DB/rules/basic.php 2 locations

@@ 73-115 (lines=43) @@
70
    private $impl;
71
}
72
73
class WhereRule extends OrderByRule
74
{
75
    public function __construct(Context $context, $isTheFirst = true)
76
    {
77
        parent::__construct($context);
78
        $this->isTheFirst = $isTheFirst;
79
    }
80
81
    /**
82
     * where('a=?', 1) => "WHERE a=1"
83
     * where('a=?', Sql::raw('now()')) => "WHERE a=now()"
84
     * where('a IN (?)',  [1, 2]) => "WHERE a IN (1,2)"
85
     * where([
86
     *      'a'=>1,
87
     *      'b'=>['IN'=>[1,2]]
88
     *      'c'=>['BETWEEN'=>[1,2]]
89
     *      'd'=>['<>'=>1]
90
     *      ])
91
     *      =>
92
     *      "WHERE a=1 AND b IN(1,2) AND c BETWEEN 1 AND 2 AND d<>1"
93
     *
94
     * @param string|array|callable $conditions
95
     * @param mixed $_
96
     * @return NextWhereRule
97
     */
98
    public function where($conditions=null, $_=null) {
99
        if(is_callable($conditions)){
100
            $callback = function ($context)use($conditions){
101
                $rule = new ScopedQuery($context);
102
                $conditions($rule);
103
            };
104
            $conditions = $callback;
105
        }
106
        if($this->isTheFirst){
107
            WhereImpl::where($this->context, 'WHERE' ,$conditions, array_slice(func_get_args(), 1));
108
        }else{
109
            WhereImpl::where($this->context, 'AND', $conditions, array_slice(func_get_args(), 1));
110
        }
111
        return new NextWhereRule($this->context, false);
112
    }
113
114
    protected $isTheFirst;
115
}
116
117
class NextWhereRule extends WhereRule
118
{
@@ 149-180 (lines=32) @@
146
    }
147
}
148
149
class ScopedQuery extends BasicRule
150
{
151
152
    public function __construct(Context $context, $isTheFirst = true)
153
    {
154
        parent::__construct($context);
155
        $this->isTheFirst = $isTheFirst;
156
    }
157
158
    /**
159
     * @param $expr
160
     * @param null $_
161
     * @return NextScopedQuery
162
     */
163
    public function where($expr, $_= null){
164
        if(is_callable($expr)){
165
            $callback = function ($context)use($expr){
166
                $rule = new ScopedQuery($context, true);
167
                $expr($rule);
168
            };
169
            $expr = $callback;
170
        }
171
        if($this->isTheFirst){
172
            WhereImpl::where($this->context, '', $expr, array_slice(func_get_args(), 1));
173
        }else{
174
            WhereImpl::where($this->context, 'AND', $expr, array_slice(func_get_args(), 1));
175
        }
176
        return new NextScopedQuery($this->context, false);
177
    }
178
179
    protected $isTheFirst;
180
}
181
182
class NextScopedQuery extends ScopedQuery
183
{

src/DB/rules/select.php 1 location

@@ 241-283 (lines=43) @@
238
    }
239
}
240
241
class WhereRule extends GroupByRule
242
{
243
    public function __construct(Context $context, $isTheFirst = true)
244
    {
245
        parent::__construct($context);
246
        $this->isTheFirst = $isTheFirst;
247
    }
248
249
    /**
250
     * where('a=?', 1) => "WHERE a=1"
251
     * where('a=?', Sql::raw('now()')) => "WHERE a=now()"
252
     * where('a IN (?)',  [1, 2]) => "WHERE a IN (1,2)"
253
     * where([
254
     *      'a'=>1,
255
     *      'b'=>['IN'=>[1,2]]
256
     *      'c'=>['BETWEEN'=>[1,2]]
257
     *      'd'=>['<>'=>1]
258
     *      ])
259
     *      =>
260
     *      "WHERE a=1 AND b IN(1,2) AND c BETWEEN 1 AND 2 AND d<>1"
261
     *
262
     * @param string|array|callable $conditions
263
     * @param mixed $_
264
     * @return \PhpBoot\DB\rules\select\NextWhereRule
265
     */
266
    public function where($conditions=null, $_=null) {
267
        if(is_callable($conditions)){
268
            $callback = function ($context)use($conditions){
269
                $rule = new ScopedQuery($context);
270
                $conditions($rule);
271
            };
272
            $conditions = $callback;
273
        }
274
        if($this->isTheFirst){
275
            WhereImpl::where($this->context, 'WHERE' ,$conditions, array_slice(func_get_args(), 1));
276
        }else{
277
            WhereImpl::where($this->context, 'AND', $conditions, array_slice(func_get_args(), 1));
278
        }
279
        return new NextWhereRule($this->context, false);
280
    }
281
282
    protected $isTheFirst;
283
}
284
285
286
class NextWhereRule extends WhereRule