original_string: public function afterFilter(Event $event) {
  		if (Configure::read('Shim.monitorHeaders') && $this->name !== 'Error' && PHP_SAPI !== 'cli') {
  			if (headers_sent($filename, $lineNumber)) {
  				$message = sprintf('Headers already sent in %s on line %s', $filename, $lineNumber);
  				if (Configure::read('debug')) {
  					throw new Exception($message);
  				}
  				trigger_error($message);
  			}
  		}
  	}
code: public function afterFilter(Event $event) {
  		if (Configure::read('Shim.monitorHeaders') && $this->name !== 'Error' && PHP_SAPI !== 'cli') {
  			if (headers_sent($filename, $lineNumber)) {
  				$message = sprintf('Headers already sent in %s on line %s', $filename, $lineNumber);
  				if (Configure::read('debug')) {
  					throw new Exception($message);
  				}
  				trigger_error($message);
  			}
  		}
  	}
code_tokens: public function afterFilter ( Event $ event ) { if ( Configure :: read ( 'Shim.monitorHeaders' ) && $ this -> name !== 'Error' && PHP_SAPI !== 'cli' ) { if ( headers_sent ( $ filename , $ lineNumber ) ) { $ message = sprintf ( 'Headers already sent in %s on line %s' , $ filename , $ lineNumber ) ; if ( Configure :: read ( 'debug' ) ) { throw new Exception ( $ message ) ; } trigger_error ( $ message ) ; } } }
docstring: Hook to monitor headers being sent.
  
  This, if desired, adds a check if your controller actions are cleanly built and no headers
  or output is being sent prior to the response class, which should be the only one doing this.
  
  @param \Cake\Event\Event $event An Event instance
  @throws \Exception
  @return \Cake\Http\Response|null
docstring_tokens: Hook to monitor headers being sent .