Limit   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 26
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A modify() 0 4 1
1
<?php
2
3
/**
4
 * This file is part of the Happyr Doctrine Specification package.
5
 *
6
 * (c) Tobias Nyholm <[email protected]>
7
 *     Kacper Gunia <[email protected]>
8
 *     Peter Gribanov <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Happyr\DoctrineSpecification\Query;
15
16
use Doctrine\ORM\QueryBuilder;
17
18
class Limit implements QueryModifier
19
{
20
    /**
21
     * @deprecated This property will be marked as private in 2.0.
22
     *
23
     * @var int limit
24
     */
25
    protected $limit;
26
27
    /**
28
     * @param int $limit
29
     */
30
    public function __construct($limit)
31
    {
32
        $this->limit = $limit;
0 ignored issues
show
Deprecated Code introduced by
The property Happyr\DoctrineSpecification\Query\Limit::$limit has been deprecated with message: This property will be marked as private in 2.0.

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
33
    }
34
35
    /**
36
     * @param QueryBuilder $qb
37
     * @param string       $dqlAlias
38
     */
39
    public function modify(QueryBuilder $qb, $dqlAlias)
40
    {
41
        $qb->setMaxResults($this->limit);
0 ignored issues
show
Deprecated Code introduced by
The property Happyr\DoctrineSpecification\Query\Limit::$limit has been deprecated with message: This property will be marked as private in 2.0.

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
42
    }
43
}
44