getServiceLocator()->has(QtiCommunicationService::SERVICE_ID)) { $service = $this->getServiceLocator()->get(QtiCommunicationService::SERVICE_ID); if (!$service instanceof CommunicationService) { $service = new QtiCommunicationService($service->getOptions()); } } else { $service = new QtiCommunicationService(); } $channels = $service->getOption(QtiCommunicationService::OPTION_CHANNELS); if (isset($channels[QtiCommunicationService::CHANNEL_TYPE_INPUT][SyncChannel::CHANNEL_NAME])) { return \common_report_Report::createSuccess('Channel "' . (new SyncChannel())->getName() . '" already installed.'); } $service->attachChannel(new SyncChannel(), QtiCommunicationService::CHANNEL_TYPE_INPUT); $this->registerService(QtiCommunicationService::SERVICE_ID, $service); return \common_report_Report::createSuccess('Channel "' . (new SyncChannel())->getName() . '" successfully installed.'); } }