AbstractIncomingRequest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 37
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getData() 0 9 1
A initialize() 0 10 2
getIncomingParameters() 0 1 ?
1
<?php
2
/**
3
 * @link https://github.com/phpviet/omnipay-momo
4
 * @copyright (c) PHP Viet
5
 * @license [MIT](http://www.opensource.org/licenses/MIT)
6
 */
7
8
namespace Omnipay\MoMo\Message;
9
10
/**
11
 * @author Vuong Minh <[email protected]>
12
 * @since 1.0.0
13
 */
14
abstract class AbstractIncomingRequest extends AbstractRequest
15
{
16
    /**
17
     * {@inheritdoc}
18
     * @throws \Omnipay\Common\Exception\InvalidRequestException
19
     */
20
    public function getData(): array
21
    {
22
        call_user_func_array(
23
            [$this, 'validate'],
24
            array_keys($parameters = $this->getIncomingParameters())
25
        );
26
27
        return $parameters;
28
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33
    public function initialize(array $parameters = [])
34
    {
35
        parent::initialize($parameters);
36
37
        foreach ($this->getIncomingParameters() as $parameter => $value) {
38
            $this->setParameter($parameter, $value);
39
        }
40
41
        return $this;
42
    }
43
44
    /**
45
     * Trả về danh sách parameters từ MoMo gửi sang.
46
     *
47
     * @return array
48
     */
49
    abstract protected function getIncomingParameters(): array;
50
}
51