original_string: public function process($email, $fromName, $fromEmail, $maxAttempts)
      {
          try {
              if ($this->send($email, $fromName, $fromEmail)) {
                  $this
                      ->db
                      ->createCommand()
                      ->update(
                          $this->queueTable,
                          ['status' => Email::STATUS_SENT],
                          ['id' => $email['id']]
                      )
                      ->execute();
                  return true;
              }
  
              $attempt = $email['attempt'] + 1;
              if ($attempt <= $maxAttempts) {
                  $this
                      ->db
                      ->createCommand()
                      ->update(
                          $this->queueTable,
                          ['attempt' => $attempt],
                          ['id' => $email['id']]
                      )
                      ->execute();
              } else {
                  $this
                      ->db
                      ->createCommand()
                      ->update(
                          $this->queueTable,
                          ['status' => Email::STATUS_GAVEUP],
                          ['id' => $email['id']]
                      )
                      ->execute();
              }
          } catch (Exception $e) {
              Log::error($e->getMessage(), null, __METHOD__);
          }
          return false;
      }
code: public function process($email, $fromName, $fromEmail, $maxAttempts)
      {
          try {
              if ($this->send($email, $fromName, $fromEmail)) {
                  $this
                      ->db
                      ->createCommand()
                      ->update(
                          $this->queueTable,
                          ['status' => Email::STATUS_SENT],
                          ['id' => $email['id']]
                      )
                      ->execute();
                  return true;
              }
  
              $attempt = $email['attempt'] + 1;
              if ($attempt <= $maxAttempts) {
                  $this
                      ->db
                      ->createCommand()
                      ->update(
                          $this->queueTable,
                          ['attempt' => $attempt],
                          ['id' => $email['id']]
                      )
                      ->execute();
              } else {
                  $this
                      ->db
                      ->createCommand()
                      ->update(
                          $this->queueTable,
                          ['status' => Email::STATUS_GAVEUP],
                          ['id' => $email['id']]
                      )
                      ->execute();
              }
          } catch (Exception $e) {
              Log::error($e->getMessage(), null, __METHOD__);
          }
          return false;
      }
code_tokens: public function process ( $ email , $ fromName , $ fromEmail , $ maxAttempts ) { try { if ( $ this -> send ( $ email , $ fromName , $ fromEmail ) ) { $ this -> db -> createCommand ( ) -> update ( $ this -> queueTable , [ 'status' => Email :: STATUS_SENT ] , [ 'id' => $ email [ 'id' ] ] ) -> execute ( ) ; return true ; } $ attempt = $ email [ 'attempt' ] + 1 ; if ( $ attempt <= $ maxAttempts ) { $ this -> db -> createCommand ( ) -> update ( $ this -> queueTable , [ 'attempt' => $ attempt ] , [ 'id' => $ email [ 'id' ] ] ) -> execute ( ) ; } else { $ this -> db -> createCommand ( ) -> update ( $ this -> queueTable , [ 'status' => Email :: STATUS_GAVEUP ] , [ 'id' => $ email [ 'id' ] ] ) -> execute ( ) ; } } catch ( Exception $ e ) { Log :: error ( $ e -> getMessage ( ) , null , __METHOD__ ) ; } return false ; }
docstring: Tries to send email from queue and updates its status.
  @param string $email
  @param string $fromName
  @param string $fromEmail
  @param int $maxAttempts
  @return bool
docstring_tokens: Tries to send email from queue and updates its status .