Completed
Push — master ( e83455...d2af9f )
by Andrii
06:07 queued 04:16
created

WithChargeType::getChargeType()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * PHP Billing Library
4
 *
5
 * @link      https://github.com/hiqdev/php-billing
6
 * @package   php-billing
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2017-2018, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiqdev\php\billing\charge\modifiers\addons;
12
13
use hiqdev\php\billing\charge\ChargeModifier;
14
15
/**
16
 * Trait WithChargeType
17
 *
18
 * @author Dmytro Naumenko <[email protected]>
19
 */
20
trait WithChargeType
21
{
22
    public function as(string $type): ChargeModifier
23
    {
24
        return $this->addAddon('chargeType', new ChargeType($type));
0 ignored issues
show
Bug introduced by SilverFire - Dmitry Naumenko
It seems like addAddon() 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

24
        return $this->/** @scrutinizer ignore-call */ addAddon('chargeType', new ChargeType($type));
Loading history...
25
    }
26
27 4
    public function getChargeType(): ?ChargeType
28
    {
29 4
        return $this->getAddon('chargeType');
0 ignored issues
show
Bug introduced by SilverFire - Dmitry Naumenko
It seems like getAddon() 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

29
        return $this->/** @scrutinizer ignore-call */ getAddon('chargeType');
Loading history...
30
    }
31
}
32