original_string: public function add(array $product, array $data)
      {
          $result = array();
          $this->hook->attach('product.compare.add.product.before', $product, $data, $result, $this);
  
          if (!empty($result)) {
              return (array) $result;
          }
  
          if (!$this->compare->add($product['product_id'])) {
              return $this->getResultError();
          }
  
          $result = $this->getResultAdded();
          $this->hook->attach('product.compare.add.product.after', $product, $data, $result, $this);
          return (array) $result;
      }
code: public function add(array $product, array $data)
      {
          $result = array();
          $this->hook->attach('product.compare.add.product.before', $product, $data, $result, $this);
  
          if (!empty($result)) {
              return (array) $result;
          }
  
          if (!$this->compare->add($product['product_id'])) {
              return $this->getResultError();
          }
  
          $result = $this->getResultAdded();
          $this->hook->attach('product.compare.add.product.after', $product, $data, $result, $this);
          return (array) $result;
      }
code_tokens: public function add ( array $ product , array $ data ) { $ result = array ( ) ; $ this -> hook -> attach ( 'product.compare.add.product.before' , $ product , $ data , $ result , $ this ) ; if ( ! empty ( $ result ) ) { return ( array ) $ result ; } if ( ! $ this -> compare -> add ( $ product [ 'product_id' ] ) ) { return $ this -> getResultError ( ) ; } $ result = $ this -> getResultAdded ( ) ; $ this -> hook -> attach ( 'product.compare.add.product.after' , $ product , $ data , $ result , $ this ) ; return ( array ) $ result ; }
docstring: Adds a product to comparison and returns an array of results
  @param array $product
  @param array $data
  @return array
docstring_tokens: Adds a product to comparison and returns an array of results