Statement::getResponse()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 1 Features 1
Metric Value
c 3
b 1
f 1
dl 0
loc 10
rs 9.4286
cc 3
eloc 6
nc 4
nop 0
1
<?php
2
namespace Cassandra;
3
4
class Statement{
5
	/**
6
	 * @var Connection
7
	 */
8
	protected $_connection;
9
	
10
	/**
11
	 * 
12
	 * @var int
13
	 */
14
	protected $_streamId;
15
	
16
	/**
17
	 * 
18
	 * @var Response\Response
19
	 */
20
	protected $_response;
21
	
22
	public function __construct($connection, $streamId){
23
		$this->_connection = $connection;
24
		$this->_streamId = $streamId;		
25
	}
26
	
27
	/**
28
	 * 
29
	 * @throws Response\Exception
30
	 * @return Response\Response
31
	 */
32
	public function getResponse(){
33
		if($this->_response === null){
34
			$this->_connection->getResponse($this->_streamId);
35
		}
36
		
37
		if ($this->_response instanceof Response\Error)
38
			throw $this->_response->getException();
39
		
40
		return $this->_response;
41
	}
42
	
43
	/**
44
	 * 
45
	 * @param Response\Response $response
46
	 */
47
	public function setResponse($response){
48
		$this->_response = $response;
49
	}
50
}
51