original_string: protected function attachFields(array &$product)
      {
          if (empty($product)) {
              return $product;
          }
  
          $product['field'] = $this->product_field->getList($product['product_id']);
  
          if (empty($product['field']['option'])) {
              return $product;
          }
  
          foreach ($product['field']['option'] as &$field_values) {
              $field_values = array_unique($field_values);
          }
  
          return $product;
      }
code: protected function attachFields(array &$product)
      {
          if (empty($product)) {
              return $product;
          }
  
          $product['field'] = $this->product_field->getList($product['product_id']);
  
          if (empty($product['field']['option'])) {
              return $product;
          }
  
          foreach ($product['field']['option'] as &$field_values) {
              $field_values = array_unique($field_values);
          }
  
          return $product;
      }
code_tokens: protected function attachFields ( array & $ product ) { if ( empty ( $ product ) ) { return $ product ; } $ product [ 'field' ] = $ this -> product_field -> getList ( $ product [ 'product_id' ] ) ; if ( empty ( $ product [ 'field' ] [ 'option' ] ) ) { return $ product ; } foreach ( $ product [ 'field' ] [ 'option' ] as & $ field_values ) { $ field_values = array_unique ( $ field_values ) ; } return $ product ; }
docstring: Adds fields to the product
  @param array $product
  @return array
docstring_tokens: Adds fields to the product