original_string: private function isTransactionUpdated(Cart $cart)
      {
          if (false === $this->session->has('transaction-id')) {
              return false;
          }
  
          /** @var TransactionRepository $transactionRepository */
          $transactionRepository = $this->manager->getRepository('EcommerceBundle:Transaction');
  
          /** @var Order $order */
          $transaction = $transactionRepository->find($this->session->get('transaction-id'));
  
          /** @var ArrayCollection $cartItems */
          $cartItems = $cart->getItems();
          /** @var ArrayCollection $orderItems */
          $productPurchases = $transaction->getItems();
  
          if ($cartItems->count() !== $productPurchases->count()) {
              return false;
          }
  
          for ($i=0; $i<$cartItems->count(); $i++) {
              /** @var CartItem $cartItem */
              $cartItem = $cartItems[$i];
              /** @var OrderItem $orderItem */
              $productPurchase = $productPurchases[$i];
  
              if ($cartItem->getProduct()->getId() !== $productPurchase->getProduct()->getId() ||
                  $cartItem->getQuantity() !== $productPurchase->getQuantity()) {
                  return false;
              }
          }
  
          return true;
      }
code: private function isTransactionUpdated(Cart $cart)
      {
          if (false === $this->session->has('transaction-id')) {
              return false;
          }
  
          /** @var TransactionRepository $transactionRepository */
          $transactionRepository = $this->manager->getRepository('EcommerceBundle:Transaction');
  
          /** @var Order $order */
          $transaction = $transactionRepository->find($this->session->get('transaction-id'));
  
          /** @var ArrayCollection $cartItems */
          $cartItems = $cart->getItems();
          /** @var ArrayCollection $orderItems */
          $productPurchases = $transaction->getItems();
  
          if ($cartItems->count() !== $productPurchases->count()) {
              return false;
          }
  
          for ($i=0; $i<$cartItems->count(); $i++) {
              /** @var CartItem $cartItem */
              $cartItem = $cartItems[$i];
              /** @var OrderItem $orderItem */
              $productPurchase = $productPurchases[$i];
  
              if ($cartItem->getProduct()->getId() !== $productPurchase->getProduct()->getId() ||
                  $cartItem->getQuantity() !== $productPurchase->getQuantity()) {
                  return false;
              }
          }
  
          return true;
      }
code_tokens: private function isTransactionUpdated ( Cart $ cart ) { if ( false === $ this -> session -> has ( 'transaction-id' ) ) { return false ; } /** @var TransactionRepository $transactionRepository */ $ transactionRepository = $ this -> manager -> getRepository ( 'EcommerceBundle:Transaction' ) ; /** @var Order $order */ $ transaction = $ transactionRepository -> find ( $ this -> session -> get ( 'transaction-id' ) ) ; /** @var ArrayCollection $cartItems */ $ cartItems = $ cart -> getItems ( ) ; /** @var ArrayCollection $orderItems */ $ productPurchases = $ transaction -> getItems ( ) ; if ( $ cartItems -> count ( ) !== $ productPurchases -> count ( ) ) { return false ; } for ( $ i = 0 ; $ i < $ cartItems -> count ( ) ; $ i ++ ) { /** @var CartItem $cartItem */ $ cartItem = $ cartItems [ $ i ] ; /** @var OrderItem $orderItem */ $ productPurchase = $ productPurchases [ $ i ] ; if ( $ cartItem -> getProduct ( ) -> getId ( ) !== $ productPurchase -> getProduct ( ) -> getId ( ) || $ cartItem -> getQuantity ( ) !== $ productPurchase -> getQuantity ( ) ) { return false ; } } return true ; }
docstring: Compare current cart with current transaction
  
  @param CartInterface $cart
  
  @return boolean
docstring_tokens: Compare current cart with current transaction