ParametersNormalization::normalizeParameters()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.9
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
/**
3
 * @link https://github.com/phpviet/omnipay-vnpay
4
 *
5
 * @copyright (c) PHP Viet
6
 * @license [MIT](https://opensource.org/licenses/MIT)
7
 */
8
9
namespace Omnipay\VNPay\Concerns;
10
11
/**
12
 * @author Vuong Minh <[email protected]>
13
 * @since 1.0.0
14
 */
15
trait ParametersNormalization
16
{
17
    /**
18
     * Phương thức hổ trợ xóa bỏ các ký tự `_` khi thiết lập các parameters.
19
     *
20
     * @param  array  $parameters
21
     * @return array
22
     */
23
    protected function normalizeParameters(array $parameters): array
24
    {
25
        $normalizedParameters = [];
26
27
        foreach ($parameters as $parameter => $value) {
28
            $parameter = str_replace('_', '', $parameter);
29
            $normalizedParameters[$parameter] = $value;
30
        }
31
32
        return $normalizedParameters;
33
    }
34
}
35