1 | <?php |
||
2 | |||
3 | namespace Pronamic\WordPress\Pay\Gateways\TargetPay; |
||
4 | |||
5 | use Pronamic\WordPress\Pay\Gateways\Common\AbstractIntegration; |
||
6 | |||
7 | /** |
||
8 | * Title: TargetPay integration |
||
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 Integration extends AbstractIntegration { |
||
18 | public function __construct() { |
||
19 | $this->id = 'targetpay-ideal'; |
||
20 | $this->name = 'TargetPay - iDEAL'; |
||
21 | $this->product_url = __( 'https://www.targetpay.com/info/ideal?setlang=en', 'pronamic_ideal' ); |
||
22 | $this->dashboard_url = 'https://www.targetpay.com/login'; |
||
23 | $this->provider = 'targetpay'; |
||
24 | |||
25 | $this->set_manual_url( __( 'https://www.pronamic.eu/support/how-to-connect-targetpay-with-wordpress-via-pronamic-pay/', 'pronamic_ideal' ) ); |
||
0 ignored issues
–
show
|
|||
26 | } |
||
27 | |||
28 | /** |
||
29 | * Get settings fields. |
||
30 | * |
||
31 | * @return array |
||
32 | */ |
||
33 | public function get_settings_fields() { |
||
34 | $fields = array(); |
||
35 | |||
36 | // Intro. |
||
37 | $fields[] = array( |
||
38 | 'section' => 'general', |
||
39 | 'type' => 'html', |
||
40 | 'html' => sprintf( |
||
41 | /* translators: 1: TargetPay */ |
||
42 | __( 'Account details are provided by %1$s after registration. These settings need to match with the %1$s dashboard.', 'pronamic_ideal' ), |
||
43 | __( 'TargetPay', 'pronamic_ideal' ) |
||
44 | ), |
||
45 | ); |
||
46 | |||
47 | // Layout Code. |
||
48 | $fields[] = array( |
||
49 | 'section' => 'general', |
||
50 | 'filter' => FILTER_SANITIZE_STRING, |
||
51 | 'meta_key' => '_pronamic_gateway_targetpay_layoutcode', |
||
52 | 'title' => __( 'Layout Code', 'pronamic_ideal' ), |
||
53 | 'type' => 'text', |
||
54 | 'tooltip' => __( 'Layout code as mentioned at <strong>Sub accounts</strong> in the TargetPay dashboard.', 'pronamic_ideal' ), |
||
55 | ); |
||
56 | |||
57 | return $fields; |
||
58 | } |
||
59 | |||
60 | public function get_config( $post_id ) { |
||
61 | $config = new Config(); |
||
62 | |||
63 | $config->layoutcode = get_post_meta( $post_id, '_pronamic_gateway_targetpay_layoutcode', true ); |
||
64 | $config->mode = get_post_meta( $post_id, '_pronamic_gateway_mode', true ); |
||
0 ignored issues
–
show
It seems like
get_post_meta($post_id, ...ic_gateway_mode', true) can also be of type false . However, the property $mode is declared as type string . Maybe add an additional type check?
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly. For example, imagine you have a variable Either this assignment is in error or a type check should be added for that assignment. class Id
{
public $id;
public function __construct($id)
{
$this->id = $id;
}
}
class Account
{
/** @var Id $id */
public $id;
}
$account_id = false;
if (starsAreRight()) {
$account_id = new Id(42);
}
$account = new Account();
if ($account instanceof Id)
{
$account->id = $account_id;
}
Loading history...
|
|||
65 | |||
66 | return $config; |
||
67 | } |
||
68 | |||
69 | /** |
||
70 | * Get gateway. |
||
71 | * |
||
72 | * @param int $post_id Post ID. |
||
73 | * @return Gateway |
||
74 | */ |
||
75 | public function get_gateway( $post_id ) { |
||
76 | return new Gateway( $this->get_config( $post_id ) ); |
||
77 | } |
||
78 | } |
||
79 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.