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

Amount   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 6
c 1
b 0
f 0
dl 0
loc 22
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getAmount() 0 5 2
A setAmount() 0 4 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