original_string: public function setCsrfProtection($value)
      {
          $this->csrfProtection = (bool)$value;
  
          if (!$value) {
              $this->removeFieldByName('csrftoken');
          } else {
              $field = $this->getFieldByName('csrftoken');
  
              // if the field does not exists yet, lets add it.
              if ($field === null) {
                  $submitted = $this->isSubmitted();
  
                  // Add a hidden 'csrftoken' field.
                  $field = $this->hiddenField('csrftoken');
  
                  $field->addValidator(new CsrfValidator());
  
                  if (!$submitted && !$field->getValue()) {
                      $field->setValue(CsrfValidator::generateToken());
                  }
              }
          }
  
          return $this;
      }
code: public function setCsrfProtection($value)
      {
          $this->csrfProtection = (bool)$value;
  
          if (!$value) {
              $this->removeFieldByName('csrftoken');
          } else {
              $field = $this->getFieldByName('csrftoken');
  
              // if the field does not exists yet, lets add it.
              if ($field === null) {
                  $submitted = $this->isSubmitted();
  
                  // Add a hidden 'csrftoken' field.
                  $field = $this->hiddenField('csrftoken');
  
                  $field->addValidator(new CsrfValidator());
  
                  if (!$submitted && !$field->getValue()) {
                      $field->setValue(CsrfValidator::generateToken());
                  }
              }
          }
  
          return $this;
      }
code_tokens: public function setCsrfProtection ( $ value ) { $ this -> csrfProtection = ( bool ) $ value ; if ( ! $ value ) { $ this -> removeFieldByName ( 'csrftoken' ) ; } else { $ field = $ this -> getFieldByName ( 'csrftoken' ) ; // if the field does not exists yet, lets add it. if ( $ field === null ) { $ submitted = $ this -> isSubmitted ( ) ; // Add a hidden 'csrftoken' field. $ field = $ this -> hiddenField ( 'csrftoken' ) ; $ field -> addValidator ( new CsrfValidator ( ) ) ; if ( ! $ submitted && ! $ field -> getValue ( ) ) { $ field -> setValue ( CsrfValidator :: generateToken ( ) ) ; } } } return $ this ; }
docstring: Should we enable Cross Site Request Forgery protection?
  If not given, we will use possible default settings.
  If those are not set, we will enable it for POST forms.
  Set the value for csrfProtection
  
  @param bool $value
  @return Form
docstring_tokens: Should we enable Cross Site Request Forgery protection? If not given we will use possible default settings . If those are not set we will enable it for POST forms . Set the value for csrfProtection