original_string: public function status($id, $status)
      {
          if (in_array($status, ['pending', 'approved', 'spam', 'trash'])) {
              $this->loadModel('Comment.Comments');
              if ($comment = $this->Comments->get($id)) {
                  $comment->set('status', $status);
                  $this->Comments->save($comment);
              }
          }
  
          $this->title(__d('comment', 'Change Comment Status'));
          $this->redirect($this->referer());
      }
code: public function status($id, $status)
      {
          if (in_array($status, ['pending', 'approved', 'spam', 'trash'])) {
              $this->loadModel('Comment.Comments');
              if ($comment = $this->Comments->get($id)) {
                  $comment->set('status', $status);
                  $this->Comments->save($comment);
              }
          }
  
          $this->title(__d('comment', 'Change Comment Status'));
          $this->redirect($this->referer());
      }
code_tokens: public function status ( $ id , $ status ) { if ( in_array ( $ status , [ 'pending' , 'approved' , 'spam' , 'trash' ] ) ) { $ this -> loadModel ( 'Comment.Comments' ) ; if ( $ comment = $ this -> Comments -> get ( $ id ) ) { $ comment -> set ( 'status' , $ status ) ; $ this -> Comments -> save ( $ comment ) ; } } $ this -> title ( __d ( 'comment' , 'Change Comment Status' ) ) ; $ this -> redirect ( $ this -> referer ( ) ) ; }
docstring: Changes the status of the given comment.
  
  @param int $id Comment id
  @param string $status New status for the comment
  @return void Redirects to previous page
docstring_tokens: Changes the status of the given comment .