original_string: public function setCallback($env, callable $callable = null)
      {
          $this->swapCallable($env, $callable, $this->running_env);
          
          $this->callbacks[$env] = $callable;
          if (empty($this->errors[$env])) {
              $this->setCoreErrors($env, self::getDefaultCoreErrors());
          }
          if (empty($this->exceptions[$env])) {
              $this->setUncaughtExceptions($env, self::$default_exceptions);
          }
          
          return $this;
      }
code: public function setCallback($env, callable $callable = null)
      {
          $this->swapCallable($env, $callable, $this->running_env);
          
          $this->callbacks[$env] = $callable;
          if (empty($this->errors[$env])) {
              $this->setCoreErrors($env, self::getDefaultCoreErrors());
          }
          if (empty($this->exceptions[$env])) {
              $this->setUncaughtExceptions($env, self::$default_exceptions);
          }
          
          return $this;
      }
code_tokens: public function setCallback ( $ env , callable $ callable = null ) { $ this -> swapCallable ( $ env , $ callable , $ this -> running_env ) ; $ this -> callbacks [ $ env ] = $ callable ; if ( empty ( $ this -> errors [ $ env ] ) ) { $ this -> setCoreErrors ( $ env , self :: getDefaultCoreErrors ( ) ) ; } if ( empty ( $ this -> exceptions [ $ env ] ) ) { $ this -> setUncaughtExceptions ( $ env , self :: $ default_exceptions ) ; } return $ this ; }
docstring: Sets the callback that will be called when an error is handled
  
  Uses the currently running environment when none is given.
  
  Examples:
  ```php
  $handler->setCallback(function($handler) {
  // The $handler parameter is the ErrorHandler instance.
  // The $handler->getLastError() method returns an exception which
  // describes the error.
  include("templates/error.php");
  });
  
  $handler->setCallback("live", function($handler) {
  include("templates/error_live.php");
  });
  
  $handler->setCallback("dev", function($handler) {
  include("templates/error_dev.php");
  });
  ```
  
  @param string|callable $env      Name of the environment
  @param callable|null   $callable The error callback
  
  @return $this
docstring_tokens: Sets the callback that will be called when an error is handled