Completed
Push — master ( 7a39a3...7e3634 )
by Gilmar
02:28
created

Order::amountFormat()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of gpupo/adyen-sdk
5
 *
6
 * (c) Gilmar Pupo <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 *
11
 * For more information, see
12
 * <http://www.g1mr.com/adyen-sdk/>.
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
 */
38
class Order extends EntityAbstract implements EntityInterface
39
{
40
    public function getSchema()
41
    {
42
        return [
43
            'id'              => 'string',
44
            'shopper'         => 'object',
45
            'amount'          => 'number',
46
            'billingAddress'  => 'object',
47
            'shippingAddress' => 'object',
48
            'installments'    => 'integer',
49
            'deliveryDate'    => 'string',
50
            'createdAt'       => 'string',
51
        ];
52
    }
53
54
    protected function amountFormat($decimal_separator)
55
    {
56
        return number_format($this->get('amount'), 2, $decimal_separator, '');
57
    }
58
59
    public function getAmount()
60
    {
61
        return $this->amountFormat('.');
62
    }
63
64
    public function getAmountInt()
65
    {
66
        return $this->amountFormat('');
67
    }
68
}
69