Completed
Pull Request — develop (#13)
by Fabian
02:01
created

Amount::setAmount()   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
eloc 2
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cakasim\Payone\Sdk\Api\Message\Payment\Parameter;
6
7
/**
8
 * Implements getter and setter for the amount API request parameter.
9
 *
10
 * @author Fabian Böttcher <[email protected]>
11
 * @since 0.1.0
12
 */
13
trait Amount
14
{
15
    /**
16
     * @inheritDoc
17
     */
18
    public function getAmount(): ?int
19
    {
20
        return isset($this->parameters['amount'])
21
            ? (int) $this->parameters['amount']
22
            : null;
23
    }
24
25
    /**
26
     * Sets the amount.
27
     *
28
     * @param int $amount The amount.
29
     * @return $this
30
     */
31
    public function setAmount(int $amount): self
32
    {
33
        $this->parameters['amount'] = (string) $amount;
0 ignored issues
show
Bug Best Practice introduced by
The property parameters does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
34
        return $this;
35
    }
36
}
37