<commit_before><?PHP

namespace Firelit;

abstract class ApiResponse extends ServerResponse {
	
	protected $response = array();
	protected $responseSent = false;
	
	protected $callback = false;

	static $responseType = false;
	static $responseObject;
	
	public function __construct() { 
		parent::__construct();
	}
	
	public function setTemplate($template) {
		$this->response = array_merge($this->response, $template);	
	}
	
	public function set($response) {
		$this->response = array_merge($this->response, $response);	
	}
	
	public function respondAndEnd($response = array()) {
		$this->respond($response, true);
		exit;	
	}
	
	public function responseComplete() {
		
		if ($this->responseSent) return true;
		
		if ($this->code == 204) return true;
			
		return false;
		
	}

	abstract public function respond($response = array(), $end = false) { }
	
	public function setCallback($function) {
		// $function should be a closure that can be called on destruct
		// It should take one parameter, the HTTP response code
		$this->callback = $function;
	}

	public function mute() {
		$this->responseSent = true;
	}
	
	public function __destruct() {
		if (is_callable($this->callback)) $this->callback($this->code);

		if ($this->responseSent) return;
		
		$this->respond();
	}
	
}<commit_msg>Fixed bug - abstract function had body<commit_after><?PHP

namespace Firelit;

abstract class ApiResponse extends ServerResponse {
	
	protected $response = array();
	protected $responseSent = false;
	
	protected $callback = false;

	static $responseType = false;
	static $responseObject;
	
	public function __construct() { 
		parent::__construct();
	}
	
	public function setTemplate($template) {
		$this->response = array_merge($this->response, $template);	
	}
	
	public function set($response) {
		$this->response = array_merge($this->response, $response);	
	}
	
	public function respondAndEnd($response = array()) {
		$this->respond($response, true);
		exit;	
	}
	
	public function responseComplete() {
		
		if ($this->responseSent) return true;
		
		if ($this->code == 204) return true;
			
		return false;
		
	}

	abstract public function respond($response = array(), $end = false);
	
	public function setCallback($function) {
		// $function should be a closure that can be called on destruct
		// It should take one parameter, the HTTP response code
		$this->callback = $function;
	}

	public function mute() {
		$this->responseSent = true;
	}
	
	public function __destruct() {
		if (is_callable($this->callback)) $this->callback($this->code);

		if ($this->responseSent) return;
		
		$this->respond();
	}
	
}
{'fraction_non_alphanumeric': 0.13200306983883345, 'fraction_numerical': 0.0023023791250959325, 'mean_word_length': 4.0523255813953485, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4863351', 'n_tokens_mistral': 851, 'n_tokens_neox': 737, 'n_words': 217}