Statement::setResponse()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 1
Metric Value
c 2
b 1
f 1
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 1
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