Completed
Push — master ( b4b898...f81b53 )
by Woody
11s
created

src/Query/Capability/HasLimit.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
declare(strict_types=1);
3
4
namespace Latitude\QueryBuilder\Query\Capability;
5
6
use Latitude\QueryBuilder\ExpressionInterface;
7
8
use function Latitude\QueryBuilder\literal;
9
10 View Code Duplication
trait HasLimit
0 ignored issues
show
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...
11
{
12
    /** @var int|null */
13
    protected $limit;
14
15 5
    public function limit(int $limit): self
16
    {
17 5
        $this->limit = $limit;
18 5
        return $this;
19
    }
20
21 22
    protected function applyLimit(ExpressionInterface $query): ExpressionInterface
22
    {
23 22
        return is_int($this->limit) ? $query->append('LIMIT %d', literal($this->limit)): $query;
24
    }
25
}
26