Failed Conditions
Push — develop ( 6a6fbf...2eb996 )
by Remco
19:08
created

SofortClient   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 32
ccs 0
cts 7
cp 0
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A start_transaction() 0 4 1
A __construct() 0 1 1
A remote_get() 0 1 1
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-2020 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