original_string: protected function prepareOrderComponentsCheckout($calculated)
      {
          $component_types = $this->order->getComponentTypes();
  
          $components = array();
          foreach ($calculated['components'] as $type => $component) {
  
              $components[$type] = array(
                  'price' => $component['price'],
                  'price_decimal' => $this->price->decimal($component['price'], $calculated['currency']),
                  'price_formatted' => $this->price->format($component['price'], $calculated['currency'])
              );
  
              if (empty($component['rule'])) {
                  $components[$type]['name'] = $component_types[$type];
                  continue;
              }
  
              $components[$type]['rule'] = $component['rule'];
              $components[$type]['name'] = $component['rule']['name'];
          }
  
          return $components;
      }
code: protected function prepareOrderComponentsCheckout($calculated)
      {
          $component_types = $this->order->getComponentTypes();
  
          $components = array();
          foreach ($calculated['components'] as $type => $component) {
  
              $components[$type] = array(
                  'price' => $component['price'],
                  'price_decimal' => $this->price->decimal($component['price'], $calculated['currency']),
                  'price_formatted' => $this->price->format($component['price'], $calculated['currency'])
              );
  
              if (empty($component['rule'])) {
                  $components[$type]['name'] = $component_types[$type];
                  continue;
              }
  
              $components[$type]['rule'] = $component['rule'];
              $components[$type]['name'] = $component['rule']['name'];
          }
  
          return $components;
      }
code_tokens: protected function prepareOrderComponentsCheckout ( $ calculated ) { $ component_types = $ this -> order -> getComponentTypes ( ) ; $ components = array ( ) ; foreach ( $ calculated [ 'components' ] as $ type => $ component ) { $ components [ $ type ] = array ( 'price' => $ component [ 'price' ] , 'price_decimal' => $ this -> price -> decimal ( $ component [ 'price' ] , $ calculated [ 'currency' ] ) , 'price_formatted' => $ this -> price -> format ( $ component [ 'price' ] , $ calculated [ 'currency' ] ) ) ; if ( empty ( $ component [ 'rule' ] ) ) { $ components [ $ type ] [ 'name' ] = $ component_types [ $ type ] ; continue ; } $ components [ $ type ] [ 'rule' ] = $ component [ 'rule' ] ; $ components [ $ type ] [ 'name' ] = $ component [ 'rule' ] [ 'name' ] ; } return $ components ; }
docstring: Prepares an array of price rule components
  @param array $calculated
  @return array
docstring_tokens: Prepares an array of price rule components