protected function createTaxRateFromDefinition(array $definition)
    {
        $rate = new TaxRate();
        $setValues = \Closure::bind(function ($definition) {
            $this->id = $definition['id'];
            $this->name = $definition['name'];
            if (isset($definition['default'])) {
                $this->default = $definition['default'];
            }
        }, $rate, '\CommerceGuys\Tax\Model\TaxRate');
        $setValues($definition);

        foreach ($definition['amounts'] as $amountDefinition) {
            $amount = $this->createTaxRateAmountFromDefinition($amountDefinition);
            $rate->addAmount($amount);
        }

        return $rate;
    }
protected function createTaxRateFromDefinition(array $definition)
    {
        $rate = new TaxRate();
        $setValues = \Closure::bind(function ($definition) {
            $this->id = $definition['id'];
            $this->name = $definition['name'];
            if (isset($definition['default'])) {
                $this->default = $definition['default'];
            }
        }, $rate, '\CommerceGuys\Tax\Model\TaxRate');
        $setValues($definition);

        foreach ($definition['amounts'] as $amountDefinition) {
            $amount = $this->createTaxRateAmountFromDefinition($amountDefinition);
            $rate->addAmount($amount);
        }

        return $rate;
    }
protected function createTaxRateFromDefinition ( array $ definition ) { $ rate = new TaxRate ( ) ; $ setValues = \ Closure :: bind ( function ( $ definition ) { $ this -> id = $ definition [ 'id' ] ; $ this -> name = $ definition [ 'name' ] ; if ( isset ( $ definition [ 'default' ] ) ) { $ this -> default = $ definition [ 'default' ] ; } } , $ rate , '\CommerceGuys\Tax\Model\TaxRate' ) ; $ setValues ( $ definition ) ; foreach ( $ definition [ 'amounts' ] as $ amountDefinition ) { $ amount = $ this -> createTaxRateAmountFromDefinition ( $ amountDefinition ) ; $ rate -> addAmount ( $ amount ) ; } return $ rate ; }
Creates a tax rate object from the provided definition.

@param array $definition The tax rate definition.

@return TaxRate
Creates a tax rate object from the provided definition .