Issues (33)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

src/Model/Setting/PaymentSetting.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
declare(strict_types=1);
4
5
namespace Billogram\Model\Setting;
6
7
use Billogram\Model\CreatableFromArray;
8
9
/**
10
 * @author Ibrahim Hizeoui <[email protected]>
11
 */
12
class PaymentSetting implements CreatableFromArray
13
{
14
    /**
15
     * @var string
16
     */
17
    private $bankgiro;
18
19
    /**
20
     * @var string
21
     */
22
    private $plusgiro;
23
24
    /**
25
     * @var array
26
     */
27
    private $domesticBankAccount;
28
29
    /**
30
     * @var array
31
     */
32
    private $internationalBankAccount;
33
34
    /**
35
     * @return mixed
36
     */
37
    public function getBankgiro()
38
    {
39
        return $this->bankgiro;
40
    }
41
42
    /**
43
     * @param $bankgiro
44
     *
45
     * @return PaymentSetting
46
     */
47
    public function withBankgiro($bankgiro)
48
    {
49
        $new = clone $this;
50
        $new->bankgiro = $bankgiro;
51
52
        return $new;
53
    }
54
55
    /**
56
     * @return string
57
     */
58
    public function getPlusgiro(): string
59
    {
60
        return $this->plusgiro;
61
    }
62
63
    /**
64
     * @param string $plusgiro
65
     *
66
     * @return PaymentSetting
67
     */
68
    public function withPlusgiro(string $plusgiro)
69
    {
70
        $new = clone $this;
71
        $new->plusgiro = $plusgiro;
72
73
        return $new;
74
    }
75
76
    /**
77
     * @return mixed
78
     */
79
    public function getDomesticBankAccount()
80
    {
81
        return $this->domesticBankAccount;
82
    }
83
84
    /**
85
     * @param $domesticBankAccount
86
     *
87
     * @return PaymentSetting
88
     */
89
    public function withDomesticBankAccount($domesticBankAccount)
90
    {
91
        $new = clone $this;
92
        $new->domesticBankAccount = $domesticBankAccount;
93
94
        return $new;
95
    }
96
97
    /**
98
     * @return mixed
99
     */
100
    public function getInternationalBankAccount()
101
    {
102
        return $this->internationalBankAccount;
103
    }
104
105
    /**
106
     * @param $internationalBankAccount
107
     *
108
     * @return PaymentSetting
109
     */
110
    public function withInternationalBankAccount($internationalBankAccount)
111
    {
112
        $new = clone $this;
113
        $new->internationalBankAccount = $internationalBankAccount;
114
115
        return $new;
116
    }
117
118
    /**
119
     * Create an API response object from the HTTP response from the API server.
120
     *
121
     * @param array $data
122
     *
123
     * @return self
124
     */
125 2
    public static function createFromArray(array $data)
126
    {
127 2
        $paymentSetting = new self();
128 2
        $paymentSetting->bankgiro = $data['bankgiro'] ?? null;
129 2
        $paymentSetting->plusgiro = $data['plusgiro'] ?? null;
130 2
        $paymentSetting->domesticBankAccount = ['account_no' => $data['domestic_bank_account']['account_no'], 'clearing_no' => $data['domestic_bank_account']['clearing_no']] ?? null;
0 ignored issues
show
Documentation Bug introduced by
It seems like array('account_no' => $d...'clearing_no']) ?? null can be null. However, the property $domesticBankAccount is declared as array. Maybe change the type of the property to array|null or add a type check?

Our type inference engine has found an assignment of a scalar value (like a string, an integer or null) to a property which is an array.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.

To type hint that a parameter can be either an array or null, you can set a type hint of array and a default value of null. The PHP interpreter will then accept both an array or null for that parameter.

function aContainsB(array $needle = null, array  $haystack) {
    if (!$needle) {
        return false;
    }

    return array_intersect($haystack, $needle) == $haystack;
}

The function can be called with either null or an array for the parameter $needle but will only accept an array as $haystack.

Loading history...
131 2
        $paymentSetting->internationalBankAccount = ['bank' => $data['international_bank_account']['bank'], 'iban' => $data['international_bank_account']['iban'], 'bic' => $data['international_bank_account']['bic'], 'swift' => $data['international_bank_account']['swift']] ?? null;
0 ignored issues
show
Documentation Bug introduced by
It seems like array('bank' => $data['i...unt']['swift']) ?? null can be null. However, the property $internationalBankAccount is declared as array. Maybe change the type of the property to array|null or add a type check?

Our type inference engine has found an assignment of a scalar value (like a string, an integer or null) to a property which is an array.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.

To type hint that a parameter can be either an array or null, you can set a type hint of array and a default value of null. The PHP interpreter will then accept both an array or null for that parameter.

function aContainsB(array $needle = null, array  $haystack) {
    if (!$needle) {
        return false;
    }

    return array_intersect($haystack, $needle) == $haystack;
}

The function can be called with either null or an array for the parameter $needle but will only accept an array as $haystack.

Loading history...
132
133 2
        return $paymentSetting;
134
    }
135
136 1
    public function toArray()
137
    {
138 1
        $data = [];
139 1
        if (null !== $this->bankgiro) {
140 1
            $data['bankgiro'] = $this->bankgiro;
141
        }
142 1
        if (null !== $this->plusgiro) {
143 1
            $data['plusgiro'] = $this->plusgiro;
144
        }
145 1
        if (null !== $this->domesticBankAccount['account_no'] && null !== $this->domesticBankAccount['clearing_no']) {
146 1
            $data['domestic_bank_account']['account_no'] = $this->domesticBankAccount['account_no'];
147 1
            $data['domestic_bank_account']['clearing_no'] = $this->domesticBankAccount['clearing_no'];
148
        }
149 1
        if (null !== $this->internationalBankAccount['iban']) {
150 1
            $data['international_bank_account']['iban'] = $this->internationalBankAccount['iban'];
151
152 1 View Code Duplication
            if (null !== $this->internationalBankAccount['iban'] && null !== $this->internationalBankAccount['bank']) {
153 1
                $data['international_bank_account']['bank'] = $this->internationalBankAccount['bank'];
154
            }
155 1 View Code Duplication
            if (null !== $this->internationalBankAccount['bic']) {
156 1
                $data['international_bank_account']['bic'] = $this->internationalBankAccount['bic'];
157
            }
158 1 View Code Duplication
            if (null !== $this->internationalBankAccount['swift']) {
159 1
                $data['international_bank_account']['swift'] = $this->internationalBankAccount['swift'];
160
            }
161
        }
162
163 1
        return $data;
164
    }
165
}
166