Passed
Branch v1.4.0 (ac3196)
by Wanderson
01:13
created

OrderTrait   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 37
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A older() 0 5 1
A orderBy() 0 5 1
A newer() 0 5 1
1
<?php
2
3
namespace Win\Database\Orm\Traits;
4
5
trait OrderTrait
6
{
7
	/** @var Select */
0 ignored issues
show
Bug introduced by
The type Win\Database\Orm\Traits\Select was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
	private $query;
9
10
	/**
11
	 * Ordena por um campo
12
	 * @param string $orderBy
13
	 * @return static
14
	 */
15
	public function orderBy($orderBy)
16
	{
17
		$this->query->orderBy->set($orderBy);
18
19
		return $this;
20
	}
21
22
	/**
23
	 * Ordena pelos mais novos
24
	 * @return static
25
	 */
26
	public function newer()
27
	{
28
		$this->orderBy('id DESC');
29
30
		return $this;
31
	}
32
33
	/**
34
	 * Ordena pelos mais antigos
35
	 * @return static
36
	 */
37
	public function older()
38
	{
39
		$this->orderBy('id ASC');
40
41
		return $this;
42
	}
43
}
44