Passed
Pull Request — master (#209)
by Aleksei
03:14
created

QueryScope   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 24
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A apply() 0 3 1
A __construct() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cycle\ORM\Select;
6
7
/**
8
 * Provides the ability to scope query and load necessary relations into the loader.
9
 * @final
10
 */
11
class QueryScope implements ConstrainInterface
0 ignored issues
show
Deprecated Code introduced by
The interface Cycle\ORM\Select\ConstrainInterface has been deprecated: Use {@see ScopeInterface} instead. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

11
class QueryScope implements /** @scrutinizer ignore-deprecated */ ConstrainInterface

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

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

Loading history...
12
{
13
    /** @var array */
14
    private $where;
15
16
    /** @var array */
17
    private $orderBy;
18
19
    /**
20
     * @param array $where
21
     * @param array $orderBy
22
     */
23
    public function __construct(array $where, array $orderBy = [])
24
    {
25
        $this->where = $where;
26
        $this->orderBy = $orderBy;
27
    }
28
29
    /**
30
     * @inheritdoc
31
     */
32
    public function apply(QueryBuilder $query): void
33
    {
34
        $query->where($this->where)->orderBy($this->orderBy);
35
    }
36
}
37