Amount::setAmount()   A
last analyzed

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
        $amount = $this->getParameter('amount');
0 ignored issues
show
Bug introduced by
It seems like getParameter() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

20
        /** @scrutinizer ignore-call */ 
21
        $amount = $this->getParameter('amount');
Loading history...
21
        return $amount !== null
22
            ? (int) $amount
23
            : null;
24
    }
25
26
    /**
27
     * Sets the amount.
28
     *
29
     * @param int $amount The amount.
30
     * @return $this
31
     */
32
    public function setAmount(int $amount): self
33
    {
34
        $this->setParameter('amount', (string) $amount);
0 ignored issues
show
Bug introduced by
It seems like setParameter() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

34
        $this->/** @scrutinizer ignore-call */ 
35
               setParameter('amount', (string) $amount);
Loading history...
35
        return $this;
36
    }
37
}
38