Passed
Push — master ( 1d252d...bd204f )
by Daimona
01:55
created

RequestFactory::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 2
rs 10
1
<?php declare( strict_types=1 );
2
3
namespace BotRiconferme\Request;
4
5
class RequestFactory {
6
	/** @var string */
7
	private $domain;
8
9
	/**
10
	 * @param string $domain
11
	 */
12
	public function __construct( string $domain ) {
13
		$this->domain = $domain;
14
	}
15
16
	/**
17
	 * @param array $params
18
	 * @return RequestBase
19
	 */
20
	public function newFromParams( array $params ) : RequestBase {
21
		if ( extension_loaded( 'curl' ) ) {
22
			$ret = new CurlRequest( $params, $this->domain );
23
		} else {
24
			$ret = new NativeRequest( $params, $this->domain );
25
		}
26
		return $ret;
27
	}
28
}
29