original_string: public function setDefaults($arrDefaults = array())
      {
          if (is_array($arrDefaults)) {
              $this->__defaults = $arrDefaults;
          } else {
              throw new \InvalidArgumentException(
                  "Invalid argument passed in to ValidForm->setDefaults(). Expected array got " .
                  gettype($arrDefaults),
                  E_ERROR
              );
          }
      }
code: public function setDefaults($arrDefaults = array())
      {
          if (is_array($arrDefaults)) {
              $this->__defaults = $arrDefaults;
          } else {
              throw new \InvalidArgumentException(
                  "Invalid argument passed in to ValidForm->setDefaults(). Expected array got " .
                  gettype($arrDefaults),
                  E_ERROR
              );
          }
      }
code_tokens: public function setDefaults ( $ arrDefaults = array ( ) ) { if ( is_array ( $ arrDefaults ) ) { $ this -> __defaults = $ arrDefaults ; } else { throw new \ InvalidArgumentException ( "Invalid argument passed in to ValidForm->setDefaults(). Expected array got " . gettype ( $ arrDefaults ) , E_ERROR ) ; } }
docstring: Use an array to set default values on all the forms children.
  The array's keys should be the form name to set the default value of, the value is the actual value
  or values to set.
  
  Example 1 - Basic defaults:
  ```php
  //*** The form
  $objCheck = $objForm->addField("cool", "Coolest PHP Library", ValidForm::VFORM_STRING);
  
  //*** Set field 'cool' default value to "ValidForm Builder"
  $objForm->setDefaults([
  "cool" => "ValidForm Builder"
  ]);
  ```
  
  Example 2 - An array of defaults:
  ```php
  //*** The form
  $objCheck = $objForm->addField("cool", "Cool checklist", ValidForm::VFORM_CHECK_LIST);
  $objCheck->addField("Option 1", "option1");
  $objCheck->addField("Option 2", "option2");
  $objCheck->addField("Option 3", "option3");
  
  $objCheck = $objForm->addField("cool-text", "Coolest PHP Library", ValidForm::VFORM_STRING);
  
  //*** Check options 2 and 3 by default using setDefaults()
  $objForm->setDefaults([
  "cool-text" => "ValidForm Builder",
  "cool" => ["option2", "option3"]
  ]);
  ```
  
  @param array $arrDefaults The array of default values. Keys are field names, values strings or arrays
  @throws \InvalidArgumentException
docstring_tokens: Use an array to set default values on all the forms children . The array s keys should be the form name to set the default value of the value is the actual value or values to set .