Failed Conditions
Push — develop ( 778feb...be6ed4 )
by Reüel
04:00
created

SofortClient::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 1
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 0
nc 1
nop 0
dl 0
loc 1
ccs 0
cts 1
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Pronamic\WordPress\Pay\Gateways\TargetPay;
4
5
use Pronamic\WordPress\Pay\Core\Util;
6
7
/**
8
 * Title: TargetPay SOFORT Banking client
9
 * Description:
10
 * Copyright: 2005-2019 Pronamic
11
 * Company: Pronamic
12
 *
13
 * @author  Remco Tolsma
14
 * @version 2.0.0
15
 * @since   1.0.0
16
 */
17
class SofortClient {
18
	/**
19
	 * URL to start an transaction
20
	 *
21
	 * @var string
22
	 */
23
	const URL_START_TRANSACTION = 'https://www.targetpay.com/directebanking/start';
24
25
	/**
26
	 * Constructs and initializes an TargetPay SOFORT Banking client object
27
	 */
28
	public function __construct() {
29
30
	}
31
32
	/**
33
	 * Remote get.
34
	 *
35
	 * @param string $url Request URL.
36
	 */
37
	private static function remote_get( $url ) {
0 ignored issues
show
Unused Code introduced by
The parameter $url is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

37
	private static function remote_get( /** @scrutinizer ignore-unused */ $url ) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
38
	}
39
40
	/**
41
	 * Start transaction
42
	 *
43
	 * @param SofortStartParameters $parameters Sofort start parameters.
44
	 */
45
	public function start_transaction( SofortStartParameters $parameters ) {
46
		$url = Util::build_url( self::URL_START_TRANSACTION, (array) $parameters );
47
48
		$data = self::remote_get( $url );
0 ignored issues
show
Unused Code introduced by
The assignment to $data is dead and can be removed.
Loading history...
Bug introduced by
Are you sure the assignment to $data is correct as self::remote_get($url) targeting Pronamic\WordPress\Pay\G...ortClient::remote_get() seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
49
50
		// @todo need work
51
	}
52
}
53