Completed
Push — master ( 718d85...a50954 )
by Piotr
43:28
created

Query::getStart()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * @author Morris Jobke <[email protected]>
4
 * @author Robin Appelman <[email protected]>
5
 *
6
 * @copyright Copyright (c) 2017, ownCloud GmbH
7
 * @license AGPL-3.0
8
 *
9
 * This code is free software: you can redistribute it and/or modify
10
 * it under the terms of the GNU Affero General Public License, version 3,
11
 * as published by the Free Software Foundation.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
 * GNU Affero General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU Affero General Public License, version 3,
19
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
20
 *
21
 */
22
23
namespace OC\Diagnostics;
24
25
use OCP\Diagnostics\IQuery;
26
27
class Query implements IQuery {
28
	private $sql;
29
30
	private $params;
31
32
	private $start;
33
34
	private $end;
35
36
	/**
37
	 * @param string $sql
38
	 * @param array $params
39
	 * @param int $start
40
	 */
41
	public function __construct($sql, $params, $start) {
42
		$this->sql = $sql;
43
		$this->params = $params;
44
		$this->start = $start;
45
	}
46
47
	public function end($time) {
48
		$this->end = $time;
49
	}
50
51
	/**
52
	 * @return array
53
	 */
54
	public function getParams() {
55
		return $this->params;
56
	}
57
58
	/**
59
	 * @return string
60
	 */
61
	public function getSql() {
62
		return $this->sql;
63
	}
64
65
	/**
66
	 * @return float
67
	 */
68
	public function getStart() {
69
		return $this->start;
70
	}
71
	
72
	/**
73
	 * @return float
74
	 */
75
	public function getDuration() {
76
		return $this->end - $this->start;
77
	}
78
}
79