RESTClientRequest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 0
loc 29
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
1
<?php
2
3
/**
4
 * This file is part of Communique.
5
 * 
6
 * @author Robert Main
7
 * @package Communique
8
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Communique;
15
16
/**
17
 * REST Request
18
 *
19
 * This class is used to encapsulate request related data such as method, url, headers etc. Whilst this class
20
 * is used internally, it is also made available to request interceptors for modification before the request is made.
21
 * 
22
 */
23
class RESTClientRequest {
24
25
	/** @var String The HTTTP method to use for the request. This should be either GET|PUT|POST|DELETE */
26
	public $method;
27
28
	/** @var String The URL to make the request to */
29
	public $url;
30
31
	/** @var Mixed The payload of the request  */
32
	public $payload;
33
34
	/** @var Array Request headers */
35
	public $headers;
36
37
	/**
38
	 * Request object constructor. Request properties should be set here (rather than just setting the object properties directly).
39
	 * @param String $method  The HTTP method you wish to use for the request
40
	 * @param String $url     The URL path to make the request to (relative to the API base path)
41
	 * @param Mixed  $payload The payload of the request
42
	 * @param Array  $headers Request headers
43
	 */
44
	public function __construct($method, $url, $payload, array $headers = array()) {
45
		$this->method = strtoupper($method);
46
		$this->url = $url;
47
		$this->payload = $payload;
48
		$this->headers = $headers;
49
	}
50
51
}