ParserRequestClass.php 1.43 KB
<?php
/**
 * @class ParserRequestClass
 * @brief Treats a parser request. This class inherits from ProcessRequestClass
 * @details
 */
class ParserRequestClass extends ProcessRequestClass
{
	/*
	 * @brief Init a params request
	*/
	public function init()
	{
		if (!isset($this->requestData))
			return false;
			
		$this->requestData->setType(ProcessTypeEnumClass::RUN);
		$this->requestData->setBatchEnable(FALSE);
		
		$cmd = KernelConfigClass::getKernelBinPath()."expressionParser ";
		foreach ($this->requestData->getExpressions() as $expression)
		{
			$cmd .= "-e \"".$expression."\" ";
		}
		$cmd .= "-o \"".$this->requestData->getOutputFileName()."\"";
		$this->requestData->setCmd($cmd);

		$this->requestData->setEnvVars(KernelConfigClass::getExecEnvVarArray());
			
		if (!parent::init())
			return false;
			
		$this->requestData->setSuccess(false);
		$this->requestData->setLastErrorMessage('Cannot init parser request');

		//create config files
		KernelConfigClass::setForceParamsDir($this->requestData->getLocalParamsPath());
		KernelConfigClass::write($this->requestData->getWorkingPath(), "", "", $this->requestData->getFunctionsFilePath(), $this->requestData->getConstantsFilePath(), $this->requestData->getParamTemplatesFilePath(), $this->requestData->getFunctionsArgsListFilePath());
		KernelConfigClass::setForceParamsDir("");

		return true;
	}
	/*
	 * @brief Run a params request
	*/
	public function run()
	{
		return parent::run();
	}
}
?>