 wp-pay-gateways    /
                    omnikassa-2
                      wp-pay-gateways    /
                    omnikassa-2
                
                            | 1 | <?php | ||||
| 2 | /** | ||||
| 3 | * Config factory | ||||
| 4 | * | ||||
| 5 | * @author Pronamic <[email protected]> | ||||
| 6 | * @copyright 2005-2018 Pronamic | ||||
| 7 | * @license GPL-3.0-or-later | ||||
| 8 | * @package Pronamic\WordPress\Pay\Gateways\OmniKassa2 | ||||
| 9 | */ | ||||
| 10 | |||||
| 11 | namespace Pronamic\WordPress\Pay\Gateways\OmniKassa2; | ||||
| 12 | |||||
| 13 | use Pronamic\WordPress\Pay\Core\GatewayConfigFactory; | ||||
| 14 | |||||
| 15 | /** | ||||
| 16 | * Config factory | ||||
| 17 | * | ||||
| 18 | * @author Remco Tolsma | ||||
| 19 | * @version 2.0.2 | ||||
| 20 | * @since 1.0.0 | ||||
| 21 | */ | ||||
| 22 | class ConfigFactory extends GatewayConfigFactory { | ||||
| 23 | /** | ||||
| 24 | * Get configuration by post ID. | ||||
| 25 | * | ||||
| 26 | * @param string $post_id Post ID. | ||||
| 27 | * @return Config | ||||
| 28 | */ | ||||
| 29 | 	public function get_config( $post_id ) { | ||||
| 30 | $config = new Config(); | ||||
| 31 | |||||
| 32 | $config->post_id = $post_id; | ||||
| 0 ignored issues–
                            show             Bug
    
    
    
        introduced 
                            by  
  Loading history... | |||||
| 33 | $config->mode = get_post_meta( $post_id, '_pronamic_gateway_mode', true ); | ||||
| 0 ignored issues–
                            show $post_idof typestringis incompatible with the typeintegerexpected by parameter$post_idofget_post_meta().
                                                                                                                                                                                           (
                                     Ignorable by Annotation
                                ) If this is a false-positive, you can also ignore this issue in your code via the  
  Loading history... It seems like  get_post_meta($post_id, ...ic_gateway_mode', true)can also be of typefalse. However, the property$modeis declared as typestring. 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... | |||||
| 34 | $config->refresh_token = get_post_meta( $post_id, '_pronamic_gateway_omnikassa_2_refresh_token', true ); | ||||
| 0 ignored issues–
                            show It seems like  get_post_meta($post_id, ...2_refresh_token', true)can also be of typefalse. However, the property$refresh_tokenis declared as typestring. 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... | |||||
| 35 | $config->signing_key = get_post_meta( $post_id, '_pronamic_gateway_omnikassa_2_signing_key', true ); | ||||
| 0 ignored issues–
                            show It seems like  get_post_meta($post_id, ...a_2_signing_key', true)can also be of typefalse. However, the property$signing_keyis declared as typestring. 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... | |||||
| 36 | $config->access_token = get_post_meta( $post_id, '_pronamic_gateway_omnikassa_2_access_token', true ); | ||||
| 0 ignored issues–
                            show It seems like  get_post_meta($post_id, ..._2_access_token', true)can also be of typefalse. However, the property$access_tokenis declared as typestring. 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... | |||||
| 37 | $config->access_token_valid_until = get_post_meta( $post_id, '_pronamic_gateway_omnikassa_2_access_token_valid_until', true ); | ||||
| 0 ignored issues–
                            show It seems like  get_post_meta($post_id, ...ken_valid_until', true)can also be of typefalse. However, the property$access_token_valid_untilis declared as typestring. 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... | |||||
| 38 | $config->order_id = get_post_meta( $post_id, '_pronamic_gateway_omnikassa_2_order_id', true ); | ||||
| 0 ignored issues–
                            show It seems like  get_post_meta($post_id, ...assa_2_order_id', true)can also be of typefalse. However, the property$order_idis declared as typestring. 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 | |||||
| 40 | return $config; | ||||
| 41 | } | ||||
| 42 | } | ||||
| 43 | 
