Limit::condition()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 1
c 1
b 0
f 1
dl 0
loc 3
rs 10
cc 1
nc 1
nop 1
1
<?php
2
/**
3
 * Created by enea dhack - 19/06/2020 21:33.
4
 */
5
6
namespace Vaened\Searcher\Constraints;
7
8
use Illuminate\Database\Eloquent\Builder;
9
use Vaened\Searcher\Constraint;
10
11
class Limit implements Constraint
12
{
13
    private int $limit;
14
15
    public function __construct(int $limit)
16
    {
17
        $this->limit = $limit;
18
    }
19
20
    public function condition(Builder $builder): Builder
21
    {
22
        return $builder->limit($this->limit);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $builder->limit($this->limit) could return the type Illuminate\Database\Query\Builder which is incompatible with the type-hinted return Illuminate\Database\Eloquent\Builder. Consider adding an additional type-check to rule them out.
Loading history...
23
    }
24
}
25