Completed
Push — master ( d2b3f3...05ef8e )
by João Felipe Magro
02:25
created

PaymentSerializer::serializePayment()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 23
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 23
rs 9.0856
c 0
b 0
f 0
cc 2
eloc 13
nc 2
nop 1
1
<?php
2
3
namespace Ipag\Classes\Serializer;
4
5
use Ipag\Classes\Contracts\Serializable;
6
use Ipag\Classes\Transaction;
7
8
final class PaymentSerializer implements Serializable
9
{
10
    /**
11
     * @var Transaction
12
     */
13
    private $transaction;
14
15
    public function __construct(Transaction $transaction)
16
    {
17
        $this->transaction = $transaction;
18
    }
19
20
    public function serialize()
21
    {
22
        $_returnType = [
23
            'retorno_tipo' => urlencode('xml'),
24
            'boleto_tipo'  => urlencode('xml'),
25
        ];
26
27
        $_user = $this->transaction->getIpag()->getAuthentication()->serialize();
28
        $_order = $this->transaction->getOrder()->serialize();
29
30
        return array_merge($_returnType, $_user, $_order);
31
    }
32
}
33