本文整理汇总了PHP中Swiftriver\Core\Setup::EventDistributionConfiguration方法的典型用法代码示例。如果您正苦于以下问题:PHP Setup::EventDistributionConfiguration方法的具体用法?PHP Setup::EventDistributionConfiguration怎么用?PHP Setup::EventDistributionConfiguration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Swiftriver\Core\Setup
的用法示例。
在下文中一共展示了Setup::EventDistributionConfiguration方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: RunWorkflow
public function RunWorkflow($key)
{
$logger = \Swiftriver\Core\Setup::GetLogger();
$logger->log("Core::Workflows::EventHandlers::ListAllEventHandlers::RunWorkflow [Method invoked]", \PEAR_LOG_INFO);
$logger->log("Core::Workflows::EventHandlers::ListAllEventHandlers::RunWorkflow [START: Constructing the Event Distributor]", \PEAR_LOG_DEBUG);
$eventDistributer = new \Swiftriver\Core\EventDistribution\EventDistributor();
$logger->log("Core::Workflows::EventHandlers::ListAllEventHandlers::RunWorkflow [END: Constructing the Event Distributor]", \PEAR_LOG_DEBUG);
$logger->log("Core::Workflows::EventHandlers::ListAllEventHandlers::RunWorkflow [START: Getting a full list of Event Handlers from the event distributor]", \PEAR_LOG_DEBUG);
$handlers = $eventDistributer->ListAllAvailableEventHandlers();
$logger->log("Core::Workflows::EventHandlers::ListAllEventHandlers::RunWorkflow [END: Getting a full list of Event Handlers from the event distributor]", \PEAR_LOG_DEBUG);
$logger->log("Core::Workflows::EventHandlers::ListAllEventHandlers::RunWorkflow [START: Finding out which event handlers are active]", \PEAR_LOG_DEBUG);
$config = \Swiftriver\Core\Setup::EventDistributionConfiguration();
$activeHandlers = $config->EventHandlers;
if ($activeHandlers != null && is_array($activeHandlers) && $handlers != null && is_array($handlers)) {
foreach ($activeHandlers as $activeHandler) {
foreach ($handlers as $handler) {
if ($handler->Name() == $activeHandler->name) {
$handler->active = true;
}
}
}
}
$logger->log("Core::Workflows::EventHandlers::ListAllEventHandlers::RunWorkflow [END: Finding out which event handlers are active]", \PEAR_LOG_DEBUG);
$logger->log("Core::Workflows::EventHandlers::ListAllEventHandlers::RunWorkflow [START: Parsing the handlers to JSON]", \PEAR_LOG_DEBUG);
$json = parent::ParseHandlersToJson($handlers);
$logger->log("Core::Workflows::EventHandlers::ListAllEventHandlers::RunWorkflow [END: Parsing the handlers to JSON]", \PEAR_LOG_DEBUG);
$logger->log("Core::Workflows::EventHandlers::ListAllEventHandlers::RunWorkflow [Method finished]", \PEAR_LOG_INFO);
return parent::FormatReturn($json);
}
示例2: RunWorkflow
public function RunWorkflow($json, $key)
{
$logger = \Swiftriver\Core\Setup::GetLogger();
$logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [Method invoked]", \PEAR_LOG_INFO);
$logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [START: Parsing the JSON input]", \PEAR_LOG_DEBUG);
try {
$name = parent::ParseJsonToEventHandlerName($json);
} catch (\Exception $e) {
$logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [An exception was thrown]", \PEAR_LOG_DEBUG);
$logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [{$e}]", \PEAR_LOG_ERR);
return parent::FormatErrorMessage($e);
}
$logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [END: Parsing the JSON input]", \PEAR_LOG_DEBUG);
$logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [START: Instanciating the event distributor]", \PEAR_LOG_DEBUG);
$eventDistributor = new \Swiftriver\Core\EventDistribution\EventDistributor();
$logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [END: Instanciating the event distributor]", \PEAR_LOG_DEBUG);
$logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [START: Getting all the availabel event handlers]", \PEAR_LOG_DEBUG);
$handlers = $eventDistributor->ListAllAvailableEventHandlers();
$logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [END: Getting all the availabel event handlers]", \PEAR_LOG_DEBUG);
$logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [START: Looking for a handler with the matching name]", \PEAR_LOG_DEBUG);
foreach ($handlers as $handler) {
if ($handler->Name() == $name) {
$thisHandler = $handler;
}
}
$logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [END: Looking for a handler with the matching name]", \PEAR_LOG_DEBUG);
if (!isset($thisHandler) || $thisHandler == null) {
return parent::FormatErrorMessage("No event handler found matching the name {$name}");
}
$logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [START: Constructing the configuration entry]", \PEAR_LOG_DEBUG);
$className = $thisHandler->type;
$filePath = $thisHandler->filePath;
$configEntry = new \Swiftriver\Core\ObjectModel\EventHandlerEntry($name, $className, $filePath);
$logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [END: Constructing the configuration entry]", \PEAR_LOG_DEBUG);
$logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [START: Extracting the configured event handlers from the config system]", \PEAR_LOG_DEBUG);
$config = \Swiftriver\Core\Setup::EventDistributionConfiguration();
$configuredEventHandlers = $config->EventHandlers;
$logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [END: Extracting the configured event handlers from the config system]", \PEAR_LOG_DEBUG);
$logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [START: Looking for an existing config entry for this handler]", \PEAR_LOG_DEBUG);
for ($i = 0; $i < count($configuredEventHandlers); $i++) {
if ($configuredEventHandlers[$i]->name == $name) {
$index = $i;
}
}
$logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [END: Looking for an existing config entry for this handler]", \PEAR_LOG_DEBUG);
$logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [START: Adding a configuration entry for this event handler]", \PEAR_LOG_DEBUG);
if (isset($index)) {
$configuredEventHandlers[$index] = $configEntry;
} else {
$configuredEventHandlers[] = $configEntry;
}
$logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [END: Adding a configuration entry for this event handler]", \PEAR_LOG_DEBUG);
$logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [START: Saving the configuration]", \PEAR_LOG_DEBUG);
$config->EventHandlers = $configuredEventHandlers;
$config->Save();
$logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [END: Saving the configuration]", \PEAR_LOG_DEBUG);
$logger->log("Core::Workflows::EventHandlers::ActivateEventHandlers::RunWorkflow [Method finished]", \PEAR_LOG_INFO);
return parent::FormatMessage("OK");
}
示例3: __construct
/**
* The constructor for the EventDistributor class
*/
public function __construct()
{
$logger = \Swiftriver\Core\Setup::GetLogger();
$logger->log("Core::EventDistribution::EventDistributor::__construct [Method invoked]", \PEAR_LOG_DEBUG);
$logger->log("Core::EventDistribution::EventDistributor::__construct [START: Adding configured event handlers]", \PEAR_LOG_DEBUG);
$this->eventHandlers = \Swiftriver\Core\Setup::EventDistributionConfiguration()->EventHandlers;
$logger->log("Core::EventDistribution::EventDistributor::__construct [END: Adding configured event handlers]", \PEAR_LOG_DEBUG);
$logger->log("Core::EventDistribution::EventDistributor::__construct [Method finished]", \PEAR_LOG_DEBUG);
}