Total Complexity | 5 |
Total Lines | 50 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | trait BoostableQuery |
||
12 | { |
||
13 | |||
14 | /** |
||
15 | * @var float Sets the boost value of the query, defaults to 1.0. |
||
16 | */ |
||
17 | protected $boost; |
||
18 | |||
19 | /** |
||
20 | * @return float |
||
21 | */ |
||
22 | public function getBoost() |
||
23 | { |
||
24 | return $this->boost; |
||
25 | } |
||
26 | |||
27 | /** |
||
28 | * @param float $boost |
||
29 | * |
||
30 | * @return $this |
||
31 | * |
||
32 | * @throws InvalidArgument |
||
33 | */ |
||
34 | public function setBoost($boost) |
||
35 | { |
||
36 | $this->assertBoost($boost); |
||
37 | $this->boost = $boost; |
||
38 | |||
39 | return $this; |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * @return bool |
||
44 | */ |
||
45 | public function hasBoost() |
||
46 | { |
||
47 | return $this->boost !== null; |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * @param float $boost |
||
52 | * |
||
53 | * @throws InvalidArgument |
||
54 | */ |
||
55 | protected function assertBoost($boost) |
||
61 | )); |
||
62 | } |
||
63 | } |
||
64 | } |
||
65 |