<commit_before><?php
	class jobScheduler
	{
		private $server = null;
		
		function __construct($server)
		{
			$this->server = $server;
		}
		
		public function jobInfo($id)
		{
			$result = $this->DoHTTP($this->server . 'jobInfo/' . $id);	
			return $this->processHTTP($result['status'], $result['output']);
		}
		
		public function jobList()
		{
			$result = $this->DoHTTP($this->server . 'listJobs');
			return $this->processHTTP($result['status'], $result['output']);
		}
		
		public function addJob($title, $scriptURL, $when)
		{
			$result = $this->DoHTTP(
				$this->server . 'addJob',
				array(
					'title' => $title,
					'scriptURL' => $scriptURL,
					'when' => $when
				)
			);
			
			return $this->processHTTP($result['status'], $result['output']);
		}
		
		public function updateJob($id, $title, $scriptURL, $when)
		{
			$result = $this->DoHTTP(
				$this->server . 'updateJob/' . $id,
				array(
					'title' => $title,
					'scriptURL' => $scriptURL,
					'when' => $when
				)
			);
			
			return $this->processHTTP($result['status'], $result['output']);
		}
		
		public function deleteJob($id)
		{
			$result = $this->DoHTTP($this->server . 'deleteJob/' . $id);	
			return $this->processHTTP($result['status'], $result['output']);
		}
		
		public function runJob($id)
		{
			$result = $this->DoHTTP($this->server . 'runJob/' . $id);	
			return $this->processHTTP($result['status'], $result['output']);
		}
		
		public function unlockJob($id)
		{
			$result = $this->DoHTTP($this->server . 'unlockJob/' . $id);	
			return $this->processHTTP($result['status'], $result['output']);
		}
		
		private function DoHTTP($URL, $post_fields = array())
		{
			$returnoutput = array();
			//open connection
			$ch = curl_init();
			curl_setopt($ch, CURLOPT_URL, $URL);
			curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
			//url-ify data for POST
			if (count($post_fields) > 0)
			{
				foreach ($post_fields as $key => $value)
				{
					$fields_string .= $key . '=' . $value . '&';
				}
		
				rtrim($fields_string, '&');
				curl_setopt($ch, CURLOPT_POST, count($post_fields));
				curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);
			}
		
			//execute post
			$returnoutput['output'] = curl_exec($ch);
			//Get status
			$returnoutput['status'] = curl_getinfo($ch, CURLINFO_HTTP_CODE);
			//close connection
			curl_close($ch);
			return $returnoutput;
		}
		
		private function processHTTP($status, $output)
		{
			$outputArray = array(
				'HttpStatusCode' => $status
			);
			
			if ($status == 200)
			{
				$data = @json_decode($output, true);
				
				if (is_array($data))
				{
					$outputArray = array_merge($outputArray, $data);
				}
				
				return $outputArray;
			}
			else
			{<commit_msg>now uses request style function from the callback<commit_after><?php
	class jobScheduler
	{
		private $server = null;
		
		function __construct($server)
		{
			$this->server = $server;
		}
		
		public function jobInfo($id)
		{
			return $this->request($this->server . 'jobInfo/' . $id);
		}
		
		public function jobList()
		{
			return $this->request($this->server . 'listJobs');
		}
		
		public function addJob($title, $scriptURL, $when)
		{
			return $this->request(
				$this->server . 'addJob',
				array(
					'title' => $title,
					'scriptURL' => $scriptURL,
					'when' => $when
				)
			);
		}
		
		public function updateJob($id, $title, $scriptURL, $when)
		{
			return $this->request(
				$this->server . 'updateJob/' . $id,
				array(
					'title' => $title,
					'scriptURL' => $scriptURL,
					'when' => $when
				)
			);
		}
		
		public function deleteJob($id)
		{
			return $this->request($this->server . 'deleteJob/' . $id);
		}
		
		public function runJob($id)
		{
			return $this->request($this->server . 'runJob/' . $id);
		}
		
		public function unlockJob($id)
		{
			return $this->request($this->server . 'unlockJob/' . $id);	
		}
		
		private function request($URL, $post_fields = array())
		{
			$returnoutput = array();
			//open connection
			$ch = curl_init();
			curl_setopt($ch, CURLOPT_URL, $URL);
			curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
			//url-ify data for POST
			if (count($post_fields) > 0)
			{
				foreach ($post_fields as $key => $value)
				{
					$fields_string .= $key . '=' . $value . '&';
				}
		
				rtrim($fields_string, '&');
				curl_setopt($ch, CURLOPT_POST, count($post_fields));
				curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);
			}
		
			//execute post
			$output = curl_exec($ch);
			$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
			curl_close($ch);
			
			//process output
			$outputArray = array(
				'HttpStatusCode' => $status
			);
			
			if ($status == 200)
			{
				$data = @json_decode($output, true);
				
				if (is_array($data))
				{
					$outputArray = array_merge($outputArray, $data);
				}
				
				return $outputArray;
			}
			else
			{
{'fraction_non_alphanumeric': 0.1798308929676222, 'fraction_numerical': 0.0020622808826562177, 'mean_word_length': 2.8987138263665595, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 58, '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': '2215668', 'n_tokens_mistral': 2163, 'n_tokens_neox': 1661, 'n_words': 326}