Order::getModificationValueInt()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
/*
4
 * This file is part of gpupo/adyen-sdk
5
 * Created by Gilmar Pupo <[email protected]>
6
 * For the information of copyright and license you should read the file
7
 * LICENSE which is distributed with this source code.
8
 * Para a informação dos direitos autorais e de licença você deve ler o arquivo
9
 * LICENSE que é distribuído com este código-fonte.
10
 * Para obtener la información de los derechos de autor y la licencia debe leer
11
 * el archivo LICENSE que se distribuye con el código fuente.
12
 * For more information, see <https://opensource.gpupo.com/>.
13
 */
14
15
namespace Gpupo\AdyenSdk\Payment\Request\Order;
16
17
use Gpupo\CommonSdk\Entity\EntityAbstract;
18
use Gpupo\CommonSdk\Entity\EntityInterface;
19
20
/**
21
 * @method string getId()    Acesso a id
22
 * @method setId(string $id)    Define id
23
 * @method Gpupo\AdyenSdk\Payment\Request\Order\Shopper getShopper()    Acesso a shopper
24
 * @method setShopper(Gpupo\AdyenSdk\Payment\Request\Order\Shopper $shopper)    Define shopper
25
 * @method float getAmount()    Acesso a amount
26
 * @method setAmount(float $amount)    Define amount
27
 * @method Gpupo\AdyenSdk\Payment\Request\Order\BillingAddress getBillingAddress()    Acesso a billingAddress
28
 * @method setBillingAddress(Gpupo\AdyenSdk\Payment\Request\Order\BillingAddress $billingAddress)    Define billingAddress
29
 * @method Gpupo\AdyenSdk\Payment\Request\Order\ShippingAddress getShippingAddress()    Acesso a shippingAddress
30
 * @method setShippingAddress(Gpupo\AdyenSdk\Payment\Request\Order\ShippingAddress $shippingAddress)    Define shippingAddress
31
 * @method int getInstallments()    Acesso a installments
32
 * @method setInstallments(integer $installments)    Define installments
33
 * @method string getDeliveryDate()    Acesso a deliveryDate
34
 * @method setDeliveryDate(string $deliveryDate)    Define deliveryDate
35
 * @method string getCreatedAt()    Acesso a createdAt
36
 * @method setCreatedAt(string $createdAt)    Define createdAt
37
 * @method setModificationValue(float $amount)    Define o valor para modificação
38
 */
39
class Order extends EntityAbstract implements EntityInterface
40
{
41 10
    public function getSchema()
42
    {
43
        return [
44 10
            'id'                => 'string',
45
            'shopper'           => 'object',
46
            'amount'            => 'number',
47
            'billingAddress'    => 'object',
48
            'shippingAddress'   => 'object',
49
            'installments'      => 'integer',
50
            'deliveryDate'      => 'string',
51
            'createdAt'         => 'string',
52
            'modificationValue' => 'number',
53
        ];
54
    }
55
56 9
    protected function amountFormat($decimal_separator, $key = 'amount')
57
    {
58 9
        return number_format($this->get($key), 2, $decimal_separator, '');
59
    }
60
61 1
    public function getAmount()
62
    {
63 1
        return $this->amountFormat('.');
64
    }
65
66 7
    public function getAmountInt()
67
    {
68 7
        return $this->amountFormat('');
69
    }
70
71 1
    public function getModificationValueInt()
72
    {
73 1
        return $this->amountFormat('', 'modificationValue');
74
    }
75
}
76