Completed
Push — develop ( e4c10e...940e90 )
by Jens
08:29
created

ExternalTaxRateDraft::fieldDefinitions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
ccs 6
cts 6
cp 1
rs 9.4285
cc 1
eloc 7
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * @author @jayS-de <[email protected]>
4
 */
5
6
namespace Commercetools\Core\Model\TaxCategory;
7
8
use Commercetools\Core\Model\Common\JsonObject;
9
10
/**
11
 * @package Commercetools\Core\Model\TaxCategory
12
 * @link http://dev.commercetools.com/http-api-projects-carts.html#externaltaxratedraft
13
 * @method string getName()
14
 * @method ExternalTaxRateDraft setName(string $name = null)
15
 * @method float getAmount()
16
 * @method ExternalTaxRateDraft setAmount(float $amount = null)
17
 * @method string getCountry()
18
 * @method ExternalTaxRateDraft setCountry(string $country = null)
19
 * @method string getState()
20
 * @method ExternalTaxRateDraft setState(string $state = null)
21
 * @method SubRateCollection getSubRates()
22
 * @method ExternalTaxRateDraft setSubRates(SubRateCollection $subRates = null)
23
 */
24
class ExternalTaxRateDraft extends JsonObject
25
{
26 14
    public function fieldDefinitions()
27
    {
28
        return [
29 14
            'name' => [self::TYPE => 'string'],
30 14
            'amount' => [self::TYPE => 'float'],
31 14
            'country' => [self::TYPE => 'string'],
32 14
            'state' => [self::TYPE => 'string'],
33 14
            'subRates' => [static::TYPE => '\Commercetools\Core\Model\TaxCategory\SubRateCollection']
34
        ];
35
    }
36
37
    /**
38
     * @param string $name
39
     * @param string $country
40
     * @param float $amount
41
     * @return ExternalTaxRateDraft
42
     */
43 6
    public static function ofNameCountryAndAmount($name, $country, $amount)
44
    {
45 6
        return static::of()->setName($name)->setCountry($country)->setAmount($amount);
46
    }
47
48
    /**
49
     * @param string $name
50
     * @param string $country
51
     * @param float $amount
52
     * @param SubRateCollection $subRates
53
     * @return ExternalTaxRateDraft
54
     */
55 6
    public static function ofNameCountryAmountAndSubRates($name, $country, $amount, SubRateCollection $subRates)
56
    {
57 6
        return static::of()->setName($name)->setCountry($country)->setAmount($amount)->setSubRates($subRates);
58
    }
59
60
    /**
61
     * @param string $name
62
     * @param string $country
63
     * @param SubRateCollection $subRates
64
     * @return ExternalTaxRateDraft
65
     */
66 2
    public static function ofNameCountryAndSubRates($name, $country, SubRateCollection $subRates)
67
    {
68 2
        return static::of()->setName($name)->setCountry($country)->setSubRates($subRates);
69
    }
70
}
71