Statement   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 4
Bugs 1 Features 1
Metric Value
wmc 5
c 4
b 1
f 1
lcom 1
cbo 2
dl 0
loc 47
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getResponse() 0 10 3
A setResponse() 0 3 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