Completed
Push — master ( 7a35bc...7eff79 )
by Krzysztof
05:49 queued 02:58
created

OrderByCriteria   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 39
rs 10
ccs 10
cts 10
cp 1

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getOrderBy() 0 4 1
A setOrderBy() 0 4 1
A shouldBeApplied() 0 4 1
1
<?php
2
3
namespace KGzocha\Searcher\Criteria;
4
5
/**
6
 * @author Krzysztof Gzocha <[email protected]>
7
 */
8
class OrderByCriteria implements OrderByCriteriaInterface
9
{
10
    /**
11
     * @var null|string
12
     */
13
    private $orderBy;
14
15
    /**
16
     * @param null|string $orderBy
17
     */
18 10
    public function __construct($orderBy = null)
19
    {
20 10
        $this->orderBy = $orderBy;
21 10
    }
22
23
    /**
24
     * @return null|string
25
     */
26 3
    public function getOrderBy()
27
    {
28 3
        return $this->orderBy;
29
    }
30
31
    /**
32
     * @param null|string $orderBy
33
     */
34 6
    public function setOrderBy($orderBy)
35
    {
36 6
        $this->orderBy = $orderBy;
37 6
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42 4
    public function shouldBeApplied()
43
    {
44 4
        return $this->orderBy != null;
0 ignored issues
show
Bug introduced by
It seems like you are loosely comparing $this->orderBy of type null|string against null; this is ambiguous if the string can be empty. Consider using a strict comparison !== instead.
Loading history...
45
    }
46
}
47