Completed
Push — master ( 00c767...680d7f )
by Joas
15:12 queued 01:14
created

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