Passed
Push — develop ( 2123c4...47647c )
by
unknown
15:28 queued 14s
created

ExternalTaxAmountDraft   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 5
dl 0
loc 19
ccs 5
cts 5
cp 1
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A ofTotalGrossAndTaxRate() 0 3 1
A fieldDefinitions() 0 5 1
1
<?php
2
/**
3
 * @author @jenschude <[email protected]>
4
 */
5
6
namespace Commercetools\Core\Model\Cart;
7
8
use Commercetools\Core\Model\Common\Context;
9
use Commercetools\Core\Model\Common\JsonObject;
10
use Commercetools\Core\Model\Common\Money;
11
use Commercetools\Core\Model\TaxCategory\ExternalTaxRateDraft;
12
13
/**
14
 * @package Commercetools\Core\Model\Cart
15
 * @link https://docs.commercetools.com/http-api-projects-carts.html#externaltaxamountdraft
16
 * @method Money getTotalGross()
17
 * @method ExternalTaxAmountDraft setTotalGross(Money $totalGross = null)
18
 * @method ExternalTaxRateDraft getTaxRate()
19
 * @method ExternalTaxAmountDraft setTaxRate(ExternalTaxRateDraft $taxRate = null)
20
 */
21
class ExternalTaxAmountDraft extends JsonObject
22
{
23 6
    public function fieldDefinitions()
24
    {
25
        return [
26 6
            'totalGross' => [static::TYPE => Money::class],
27 6
            'taxRate' => [static::TYPE => ExternalTaxRateDraft::class]
28
        ];
29
    }
30
31
    /**
32
     * @param Money $totalGross
33
     * @param ExternalTaxRateDraft $taxRate
34
     * @param Context|callable $context
35
     * @return ExternalTaxAmountDraft
36
     */
37 4
    public static function ofTotalGrossAndTaxRate(Money $totalGross, ExternalTaxRateDraft $taxRate, $context = null)
38
    {
39 4
        return static::of($context)->setTotalGross($totalGross)->setTaxRate($taxRate);
40
    }
41
}
42