1 | <?php |
||
2 | |||
3 | namespace Pronamic\WordPress\Pay\Gateways\Ingenico\OrderStandard; |
||
4 | |||
5 | use Pronamic\WordPress\Pay\Gateways\Ingenico\AbstractIntegration; |
||
6 | use Pronamic\WordPress\Pay\Gateways\Ingenico\Settings; |
||
7 | |||
8 | class Integration extends AbstractIntegration { |
||
9 | public function __construct( $args = array() ) { |
||
10 | $args = wp_parse_args( $args, array( |
||
11 | 'id' => 'ogone-orderstandard', |
||
12 | 'name' => 'Ingenico/Ogone - e-Commerce', |
||
13 | ) ); |
||
14 | |||
15 | parent::__construct( $args ); |
||
16 | } |
||
17 | |||
18 | /** |
||
19 | * Get settings fields. |
||
20 | * |
||
21 | * @return array |
||
22 | */ |
||
23 | public function get_settings_fields() { |
||
24 | return Settings::get_settings_fields( 'standard' ); |
||
25 | } |
||
26 | |||
27 | public function get_config( $post_id ) { |
||
28 | $mode = get_post_meta( $post_id, '_pronamic_gateway_mode', true ); |
||
29 | |||
30 | $config = new Config(); |
||
31 | |||
32 | $form_action_url = get_post_meta( $post_id, '_pronamic_gateway_ogone_form_action_url', true ); |
||
33 | |||
34 | if ( '' !== $form_action_url ) { |
||
35 | $config->set_form_action_url( $form_action_url ); |
||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
36 | } |
||
37 | |||
38 | $config->mode = $mode; |
||
0 ignored issues
–
show
It seems like
$mode 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...
|
|||
39 | $config->psp_id = get_post_meta( $post_id, '_pronamic_gateway_ogone_psp_id', true ); |
||
0 ignored issues
–
show
It seems like
get_post_meta($post_id, ...ay_ogone_psp_id', true) can also be of type false . However, the property $psp_id 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...
|
|||
40 | $config->hash_algorithm = get_post_meta( $post_id, '_pronamic_gateway_ogone_hash_algorithm', true ); |
||
0 ignored issues
–
show
It seems like
get_post_meta($post_id, ..._hash_algorithm', true) can also be of type false . However, the property $hash_algorithm 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...
|
|||
41 | $config->sha_in_pass_phrase = get_post_meta( $post_id, '_pronamic_gateway_ogone_sha_in_pass_phrase', true ); |
||
0 ignored issues
–
show
It seems like
get_post_meta($post_id, ..._in_pass_phrase', true) can also be of type false . However, the property $sha_in_pass_phrase 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...
|
|||
42 | $config->sha_out_pass_phrase = get_post_meta( $post_id, '_pronamic_gateway_ogone_sha_out_pass_phrase', true ); |
||
0 ignored issues
–
show
It seems like
get_post_meta($post_id, ...out_pass_phrase', true) can also be of type false . However, the property $sha_out_pass_phrase 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...
|
|||
43 | $config->user_id = get_post_meta( $post_id, '_pronamic_gateway_ogone_user_id', true ); |
||
0 ignored issues
–
show
It seems like
get_post_meta($post_id, ...y_ogone_user_id', true) can also be of type false . However, the property $user_id 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...
|
|||
44 | $config->password = get_post_meta( $post_id, '_pronamic_gateway_ogone_password', true ); |
||
0 ignored issues
–
show
It seems like
get_post_meta($post_id, ..._ogone_password', true) can also be of type false . However, the property $password 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...
|
|||
45 | $config->order_id = get_post_meta( $post_id, '_pronamic_gateway_ogone_order_id', true ); |
||
0 ignored issues
–
show
|
|||
46 | $config->param_var = get_post_meta( $post_id, '_pronamic_gateway_ogone_param_var', true ); |
||
0 ignored issues
–
show
|
|||
47 | $config->template_page = get_post_meta( $post_id, '_pronamic_gateway_ogone_template_page', true ); |
||
0 ignored issues
–
show
|
|||
48 | $config->alias_enabled = get_post_meta( $post_id, '_pronamic_gateway_ogone_alias_enabled', true ); |
||
0 ignored issues
–
show
|
|||
49 | $config->alias_usage = get_post_meta( $post_id, '_pronamic_gateway_ogone_alias_usage', true ); |
||
0 ignored issues
–
show
|
|||
50 | |||
51 | return $config; |
||
52 | } |
||
53 | |||
54 | /** |
||
55 | * Get gateway. |
||
56 | * |
||
57 | * @param int $post_id Post ID. |
||
58 | * @return Gateway |
||
59 | */ |
||
60 | public function get_gateway( $post_id ) { |
||
61 | return new Gateway( $this->get_config( $post_id ) ); |
||
62 | } |
||
63 | } |
||
64 |