PostCurlRequest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
eloc 7
dl 0
loc 20
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A setData() 0 3 1
1
<?php
2
/**
3
 * Class for fast making HTTP post requests
4
 *
5
 * @file      PostCurlRequest.php
6
 *
7
 * PHP version 8.0+
8
 *
9
 * @author    Yancharuk Alexander <alex at itvault dot info>
10
 * @copyright © 2012-2021 Alexander Yancharuk
11
 * @date      2015-01-20 20:16
12
 * @license   The BSD 3-Clause License
13
 *            <https://tldrlegal.com/license/bsd-3-clause-license-(revised)>
14
 */
15
16
namespace Veles\CurlRequest;
17
18
/**
19
 * Class PostCurlRequest
20
 * @author  Yancharuk Alexander <alex at itvault dot info>
21
 */
22
class PostCurlRequest extends CurlRequest
23
{
24
	/** @var array */
25
	protected $default_options = [
26
		CURLOPT_RETURNTRANSFER => true,		// output to string instead stdout
27
		CURLOPT_CONNECTTIMEOUT => 10,		// timeout on connect
28
		CURLOPT_TIMEOUT        => 10,		// timeout on request
29
		CURLOPT_POST           => true
30
	];
31
32
	/**
33
	 * Set request data
34
	 *
35
	 * @param string|array $data
36
	 *
37
	 * @return $this
38
	 */
39 2
	public function setData($data)
40
	{
41 2
		return $this->setOption(CURLOPT_POSTFIELDS, $data);
42
	}
43
}
44