本文整理汇总了PHP中Swiftriver\Core\Setup::PreProcessingStepsConfiguration方法的典型用法代码示例。如果您正苦于以下问题:PHP Setup::PreProcessingStepsConfiguration方法的具体用法?PHP Setup::PreProcessingStepsConfiguration怎么用?PHP Setup::PreProcessingStepsConfiguration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Swiftriver\Core\Setup
的用法示例。
在下文中一共展示了Setup::PreProcessingStepsConfiguration方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: RunWorkflow
public function RunWorkflow($key)
{
$logger = \Swiftriver\Core\Setup::GetLogger();
$logger->log("Core::Workflows::PreProcessingSteps::ListAllPreProcessingSteps::RunWorkflow [Method invoked]", \PEAR_LOG_INFO);
$logger->log("Core::Workflows::PreProcessingSteps::ListAllPreProcessingSteps::RunWorkflow [START: Constructing the PreProcessor]", \PEAR_LOG_DEBUG);
$preProcessor = new \Swiftriver\Core\PreProcessing\PreProcessor();
$logger->log("Core::Workflows::PreProcessingSteps::ListAllPreProcessingSteps::RunWorkflow [END: Constructing the PreProcessor]", \PEAR_LOG_DEBUG);
$logger->log("Core::Workflows::PreProcessingSteps::ListAllPreProcessingSteps::RunWorkflow [START: Listing all preprocessors]", \PEAR_LOG_DEBUG);
$steps = $preProcessor->ListAllAvailablePreProcessingSteps();
$logger->log("Core::Workflows::PreProcessingSteps::ListAllPreProcessingSteps::RunWorkflow [END: Listing all preprocessors]", \PEAR_LOG_DEBUG);
$logger->log("Core::Workflows::PreProcessingSteps::ListAllPreProcessingSteps::RunWorkflow [START: Finding out which are active]", \PEAR_LOG_DEBUG);
//Get the currently configured steps
$config = \Swiftriver\Core\Setup::PreProcessingStepsConfiguration();
$activeSteps = $config->PreProcessingSteps;
if ($activeSteps != null && is_array($activeSteps) && $steps != null && is_array($steps)) {
foreach ($activeSteps as $activeStep) {
foreach ($steps as $step) {
if ($step->Name() == $activeStep->name) {
$step->active = true;
}
}
}
}
$logger->log("Core::Workflows::PreProcessingSteps::ListAllPreProcessingSteps::RunWorkflow [END: Finding out which are active]", \PEAR_LOG_DEBUG);
$logger->log("Core::Workflows::PreProcessingSteps::ListAllPreProcessingSteps::RunWorkflow [START: Encoding results to JSON]", \PEAR_LOG_DEBUG);
$json = parent::ParseStepsToJson($steps);
$logger->log("Core::Workflows::PreProcessingSteps::ListAllPreProcessingSteps::RunWorkflow [END: Encoding results to JSON]", \PEAR_LOG_DEBUG);
$logger->log("Core::Workflows::PreProcessingSteps::ListAllPreProcessingSteps::RunWorkflow [Method finished]", \PEAR_LOG_INFO);
return parent::FormatReturn($json);
}
示例2: __construct
/**
* Constructor for te PreProcessor
* @var string|null $modulesDirectory
*/
public function __construct($modulesDirectory = null)
{
$logger = \Swiftriver\Core\Setup::GetLogger();
$logger->log("Core::PreProcessing::PreProcessor::__construct [Method invoked]", \PEAR_LOG_DEBUG);
$logger->log("Core::PreProcessing::PreProcessor::__construct [START: Adding configured pre processors]", \PEAR_LOG_DEBUG);
$this->preProcessingSteps = \Swiftriver\Core\Setup::PreProcessingStepsConfiguration()->PreProcessingSteps;
$logger->log("Core::PreProcessing::PreProcessor::__construct [END: Adding configured pre processors]", \PEAR_LOG_DEBUG);
$logger->log("Core::PreProcessing::PreProcessor::__construct [Method finished]", \PEAR_LOG_DEBUG);
}
示例3: RunWorkflow
public function RunWorkflow($json, $key)
{
$logger = \Swiftriver\Core\Setup::GetLogger();
$logger->log("Core::Workflows::PreProcessingSteps::ActivatePreProcessingStep::RunWorkflow [Method invoked]", \PEAR_LOG_INFO);
$logger->log("Core::Workflows::PreProcessingSteps::ActivatePreProcessingStep::RunWorkflow [START: Parsing the JSON input]", \PEAR_LOG_DEBUG);
try {
//Call the parent to decode the json
$preProcessingStepName = parent::ParseJsonToPreProcessingStepName($json);
} catch (\Exception $e) {
//Catch and report the exception if one is thrown
$logger->log("Core::Workflows::PreProcessingSteps::ActivatePreProcessingStep::RunWorkflow [An exception was thrown]", \PEAR_LOG_DEBUG);
$logger->log("Core::Workflows::PreProcessingSteps::ActivatePreProcessingStep::RunWorkflow [{$e}]", \PEAR_LOG_ERR);
return parent::FormatErrorMessage($e);
}
$logger->log("Core::Workflows::PreProcessingSteps::ActivatePreProcessingStep::RunWorkflow [END: Parsing the JSON input]", \PEAR_LOG_DEBUG);
$logger->log("Core::Workflows::PreProcessingSteps::ActivatePreProcessingStep::RunWorkflow [START: Listing all available pre processors]", \PEAR_LOG_DEBUG);
//Build a new pre processor
$preProcessor = new \Swiftriver\Core\PreProcessing\PreProcessor();
//list all the availaibel steps
$steps = $preProcessor->ListAllAvailablePreProcessingSteps();
$logger->log("Core::Workflows::PreProcessingSteps::ActivatePreProcessingStep::RunWorkflow [END: Listing all available pre processors]", \PEAR_LOG_DEBUG);
$logger->log("Core::Workflows::PreProcessingSteps::ActivatePreProcessingStep::RunWorkflow [START: Looking for the pre processor to activate]", \PEAR_LOG_DEBUG);
//Loop throught the steps looking for one with the same name as came from the JOSN
foreach ($steps as $s) {
if ($s->Name() == $preProcessingStepName) {
$step = $s;
}
}
//If not found, return an error.
if (!isset($step) || $step == null) {
$logger->log("Core::Workflows::PreProcessingSteps::ActivatePreProcessingStep::RunWorkflow [No pre processor with a name matching {$preProcessingStepName} was found.]", \PEAR_LOG_DEBUG);
return parent::FormatErrorMessage("No pre processor matching the name {$preProcessingStepName} could be found");
}
$logger->log("Core::Workflows::PreProcessingSteps::ActivatePreProcessingStep::RunWorkflow [END: Looking for the pre processor to activate]", \PEAR_LOG_DEBUG);
$logger->log("Core::Workflows::PreProcessingSteps::ActivatePreProcessingStep::RunWorkflow [START: Constructing the PreProcessingStep Configuration Entry]", \PEAR_LOG_DEBUG);
//Extract the required data to build a configuration entry
$className = $step->type;
$filePath = $step->filePath;
$name = $step->Name();
//Construct a new configuration entry
$preProcessorStep = new \Swiftriver\Core\ObjectModel\PreProcessingStepEntry($name, $className, $filePath);
$logger->log("Core::Workflows::PreProcessingSteps::ActivatePreProcessingStep::RunWorkflow [END: Constructing the PreProcessingStep Configuration Entry]", \PEAR_LOG_DEBUG);
$logger->log("Core::Workflows::PreProcessingSteps::ActivatePreProcessingStep::RunWorkflow [START: Adding the pre processor to the configuration]", \PEAR_LOG_DEBUG);
//Get the currently configured steps
$config = \Swiftriver\Core\Setup::PreProcessingStepsConfiguration();
$numberOfPreProcessors = count($config->PreProcessingSteps);
//See if this step is already in there
for ($i = 0; $i < $numberOfPreProcessors; $i++) {
if ($config->PreProcessingSteps[$i]->name == $preProcessorStep->name) {
$index = $i;
}
}
//Add the step to the configuration framework
if (isset($index)) {
$config->PreProcessingSteps[$index] = $preProcessorStep;
} else {
$config->PreProcessingSteps[] = $preProcessorStep;
}
$logger->log("Core::Workflows::PreProcessingSteps::ActivatePreProcessingStep::RunWorkflow [END: Adding the pre processor to the configuration]", \PEAR_LOG_DEBUG);
$logger->log("Core::Workflows::PreProcessingSteps::ActivatePreProcessingStep::RunWorkflow [START: Saving the configuration]", \PEAR_LOG_DEBUG);
//Save the config to file.
$config->Save();
$logger->log("Core::Workflows::PreProcessingSteps::ActivatePreProcessingStep::RunWorkflow [END: Saving the configuration]", \PEAR_LOG_DEBUG);
$logger->log("Core::Workflows::PreProcessingSteps::ActivatePreProcessingStep::RunWorkflow [Method finished]", \PEAR_LOG_INFO);
parent::FormatMessage("OK");
}