original_string: public function isCurrentUserOwner(Transaction $transaction)
      {
          if($this->securityContext->getToken()->getUser()->isGranted('ROLE_ADMIN')){
              return true;
          }
          
          $currentUserId = $this->securityContext->getToken()->getUser()->getId();
          //actor owner
          if($transaction->getActor() instanceof Actor){
              if($currentUserId ==  $transaction->getActor()->getId()){
                  return true;
              }elseif($currentUserId == $transaction->getItems()->first()->getProduct()->getActor()->getId()){
                  return true;
              }
          }
          
          return false;
      }
code: public function isCurrentUserOwner(Transaction $transaction)
      {
          if($this->securityContext->getToken()->getUser()->isGranted('ROLE_ADMIN')){
              return true;
          }
          
          $currentUserId = $this->securityContext->getToken()->getUser()->getId();
          //actor owner
          if($transaction->getActor() instanceof Actor){
              if($currentUserId ==  $transaction->getActor()->getId()){
                  return true;
              }elseif($currentUserId == $transaction->getItems()->first()->getProduct()->getActor()->getId()){
                  return true;
              }
          }
          
          return false;
      }
code_tokens: public function isCurrentUserOwner ( Transaction $ transaction ) { if ( $ this -> securityContext -> getToken ( ) -> getUser ( ) -> isGranted ( 'ROLE_ADMIN' ) ) { return true ; } $ currentUserId = $ this -> securityContext -> getToken ( ) -> getUser ( ) -> getId ( ) ; //actor owner if ( $ transaction -> getActor ( ) instanceof Actor ) { if ( $ currentUserId == $ transaction -> getActor ( ) -> getId ( ) ) { return true ; } elseif ( $ currentUserId == $ transaction -> getItems ( ) -> first ( ) -> getProduct ( ) -> getActor ( ) -> getId ( ) ) { return true ; } } return false ; }
docstring: Check if current user is the transaction owner
  
  @param Transaction $transaction
  
  @return boolean
docstring_tokens: Check if current user is the transaction owner