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

ExternalTaxRateDraft   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 47
ccs 12
cts 12
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A fieldDefinitions() 0 10 1
A ofNameCountryAndAmount() 0 4 1
A ofNameCountryAmountAndSubRates() 0 4 1
A ofNameCountryAndSubRates() 0 4 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