<commit_before>/**
 * OrientDB Shutdown class
 *
 * @author <NAME> <<EMAIL>>
 * @copyright <NAME> 2014
 * @license MIT License (MIT) https://github.com/hugohiram/OrientDB-Extension/blob/master/LICENSE
 * @link https://github.com/hugohiram/OrientDB-Extension
 * @package OrientDB
 */

namespace Orientdb;

Use Exception;

/**
 * Shutdown() Operation for OrientDB
 *
 * @author <NAME> <<EMAIL>>
 * @package OrientDB
 * @subpackage Operation
 */
class Shutdown extends OperationAbstract
{
	protected _serverUser;
	protected _serverPass;

	/**
	 * Orientdb\DBOpen constructor
	 *
	 * @param object parent object of caller class
	 */
	public function __construct(parent)
	{
		//echo __CLASS__;
		let this->parent = parent;
		let this->socket = parent->socket;
		//let this->transaction = -1;
		let this->operation = OperationAbstract::REQUEST_SHUTDOWN;
	}

	/**
	 * Main method to run the operation
	 * 
	 * @param string serverUser Username to connect to the OrientDB server
	 * @param string serverPass Password to connect to the OrientDB server
	 * @return string
	 */
	public function run(string serverUser, string serverPass) -> string
	{
		let this->_serverUser = serverUser;
		let this->_serverPass = serverPass;

		this->prepare();
		this->execute();
		let this->response = this->parseResponse();

		return this->response;
	}

	/**
	 * Prepare the parameters
	 * 
	 * @return void
	 */
	protected function prepare() -> void
	{
		this->resetRequest();
		let this->transaction = this->parent->getSessionServer();
		this->addByte(chr(this->operation));
		this->addInt(this->transaction);

		// server's username
		this->addString(this->_serverUser);
		// server's password
		this->addString(this->_serverPass);
	}

	/**
	 * Parse the response from the socket
	 */
	protected function parseResponse() -> void
	{
		var status, session;

		let status = this->readByte(this->socket);
		if (status == (chr(OperationAbstract::STATUS_SUCCESS))) {
			var_dump("STATUS_SUCCESS");
		}
		else {
			if (status == (chr(OperationAbstract::STATUS_ERROR))) {
				let session = this->readInt(this->socket);
				this->parent->setSessionServer(session);
				this->handleException();
			}
			else {
				throw new Exception("unknown error", 400);
			}
		}
	}
}<commit_msg>fixes on Shutdown class on parseResponse method<commit_after>/**
 * OrientDB Shutdown class
 *
 * @author <NAME> <<EMAIL>>
 * @copyright <NAME> 2014
 * @license MIT License (MIT) https://github.com/hugohiram/OrientDB-Extension/blob/master/LICENSE
 * @link https://github.com/hugohiram/OrientDB-Extension
 * @package OrientDB
 */

namespace Orientdb;

Use Exception;

/**
 * Shutdown() Operation for OrientDB
 *
 * @author <NAME> <<EMAIL>>
 * @package OrientDB
 * @subpackage Operation
 */
class Shutdown extends OperationAbstract
{
	protected _serverUser;
	protected _serverPass;

	/**
	 * Orientdb\DBOpen constructor
	 *
	 * @param object parent object of caller class
	 */
	public function __construct(parent)
	{
		//echo __CLASS__;
		let this->parent = parent;
		let this->socket = parent->socket;
		//let this->transaction = -1;
		let this->operation = OperationAbstract::REQUEST_SHUTDOWN;
	}

	/**
	 * Main method to run the operation
	 * 
	 * @param string serverUser Username to connect to the OrientDB server
	 * @param string serverPass Password to connect to the OrientDB server
	 * @return string
	 */
	public function run(string serverUser, string serverPass) -> string
	{
		let this->_serverUser = serverUser;
		let this->_serverPass = <PASSWORD>Pass;

		this->prepare();
		this->execute();
		let this->response = this->parseResponse();

		return this->response;
	}

	/**
	 * Prepare the parameters
	 * 
	 * @return void
	 */
	protected function prepare() -> void
	{
		this->resetRequest();
		let this->transaction = this->parent->getSessionServer();
		this->addByte(chr(this->operation));
		this->addInt(this->transaction);

		// server's username
		this->addString(this->_serverUser);
		// server's password
		this->addString(this->_serverPass);
	}

	/**
	 * Parse the response from the socket
	 */
	protected function parseResponse() -> void
	{
		var status, session;

		let status = this->readByte(this->socket);
		if (status == (chr(OperationAbstract::STATUS_ERROR))) {
			let session = this->readInt(this->socket);
			this->parent->setSessionServer(session);
			this->handleException();
		}
		else {
			if (status != (chr(OperationAbstract::STATUS_SUCCESS))) {
				throw new Exception("unknown error", 400);
			}
		}
	}
}
{'fraction_non_alphanumeric': 0.13694054776219106, 'fraction_numerical': 0.0035626809173903364, 'mean_word_length': 3.824919441460795, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 86, 'https://': 4, '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': '6472633', 'n_tokens_mistral': 1495, 'n_tokens_neox': 1324, 'n_words': 348}