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

src/Query/Capability/HasOffset.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 HasOffset
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 $offset;
14
15 2
    public function offset(int $offset): self
16
    {
17 2
        $this->offset = $offset;
18 2
        return $this;
19
    }
20
21 20
    protected function applyOffset(ExpressionInterface $query): ExpressionInterface
22
    {
23 20
        return is_int($this->offset) ? $query->append('OFFSET %d', literal($this->offset)): $query;
24
    }
25
}
26