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

ExternalTaxAmountDraft::ofTotalGrossAndTaxRate()   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
eloc 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
crap 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