当前位置: 首页>>代码示例>>PHP>>正文


PHP service\ServiceManager类代码示例

本文整理汇总了PHP中oat\oatbox\service\ServiceManager的典型用法代码示例。如果您正苦于以下问题:PHP ServiceManager类的具体用法?PHP ServiceManager怎么用?PHP ServiceManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ServiceManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __invoke

 /**
  * @param $params
  */
 public function __invoke($params)
 {
     $serviceManager = ServiceManager::getServiceManager();
     $assignmentService = new ProctoringAssignmentService();
     $assignmentService->setServiceManager($serviceManager);
     $serviceManager->register(ProctoringAssignmentService::CONFIG_ID, $assignmentService);
 }
开发者ID:oat-sa,项目名称:extension-tao-proctoring,代码行数:10,代码来源:RegisterAssignmentService.php

示例2: __construct

 /**
  * PciAssetHandler constructor.
  * Set PortableElementItemParser
  */
 public function __construct(Item $item, $sourceDir)
 {
     $this->portableItemParser = new PortableElementItemParser();
     $this->portableItemParser->setServiceLocator(ServiceManager::getServiceManager());
     $this->portableItemParser->setSource(rtrim($sourceDir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR);
     $this->portableItemParser->setQtiModel($item);
 }
开发者ID:oat-sa,项目名称:extension-tao-itemqti,代码行数:11,代码来源:PortableAssetHandler.php

示例3: getServiceStorage

 public static function getServiceStorage($serviceCallId)
 {
     $serviceService = ServiceManager::getServiceManager()->get('tao/stateStorage');
     $state = $serviceService->get(common_session_SessionManager::getSession()->getUserUri(), $serviceCallId);
     $submitUrl = _url('submitState', 'ServiceModule', 'tao', array('serviceCallId' => $serviceCallId));
     return 'new StateStorage(' . tao_helpers_Javascript::buildObject($state) . ', ' . tao_helpers_Javascript::buildObject($submitUrl) . ')';
 }
开发者ID:oat-sa,项目名称:tao-core,代码行数:7,代码来源:class.ServiceJavascripts.php

示例4: getTextConverterService

 /**
  * Get the TextConverterService
  *
  * @return ProctoringTextConverter
  */
 protected function getTextConverterService()
 {
     if (!$this->textConverterService) {
         $this->textConverterService = ServiceManager::getServiceManager()->get(ProctoringTextConverter::SERVICE_ID);
     }
     return $this->textConverterService;
 }
开发者ID:oat-sa,项目名称:extension-tao-proctoring,代码行数:12,代码来源:ProctoringTextConverterTrait.php

示例5: __invoke

 /**
  * @param $params
  */
 public function __invoke($params)
 {
     $serviceManager = ServiceManager::getServiceManager();
     $deliveryContainerService = new DeliveryContainerService();
     $deliveryContainerService->setServiceManager($serviceManager);
     $serviceManager->register(DeliveryContainerService::CONFIG_ID, $deliveryContainerService);
 }
开发者ID:oat-sa,项目名称:extension-tao-delivery-rdf,代码行数:10,代码来源:RegisterDeliveryContainerService.php

示例6: getIrregularities

 private function getIrregularities($delivery, $from = '', $to = '')
 {
     $export = array(array(__('date'), __('author'), __('test taker'), __('category'), __('subcategory'), __('comment')));
     $deliveryLog = ServiceManager::getServiceManager()->get(DeliveryLog::SERVICE_ID);
     $service = ResultsService::singleton();
     $implementation = $service->getReadableImplementation($delivery);
     $service->setImplementation($implementation);
     $results = $service->getImplementation()->getResultByDelivery(array($delivery->getUri()));
     foreach ($results as $res) {
         $deliveryExecution = \taoDelivery_models_classes_execution_ServiceProxy::singleton()->getDeliveryExecution($res['deliveryResultIdentifier']);
         $logs = $deliveryLog->get($deliveryExecution->getIdentifier(), 'TEST_IRREGULARITY');
         foreach ($logs as $data) {
             $exportable = array();
             if ((empty($from) || $data['created_at'] > $from) && (empty($to) || $data['created_at'] < $to)) {
                 $testTaker = new \core_kernel_classes_Resource($res['testTakerIdentifier']);
                 $author = new \core_kernel_classes_Resource($data['created_by']);
                 $exportable[] = \tao_helpers_Date::displayeDate($data['created_at']);
                 $exportable[] = $author->getLabel();
                 $exportable[] = $testTaker->getLabel();
                 $exportable[] = $data['data']['reason']['reasons']['category'];
                 $exportable[] = isset($data['data']['reason']['reasons']['subCategory']) ? $data['data']['reason']['reasons']['subCategory'] : '';
                 $exportable[] = $data['data']['reason']['comment'];
                 $export[] = $exportable;
             }
         }
     }
     return $export;
 }
开发者ID:oat-sa,项目名称:extension-tao-proctoring,代码行数:28,代码来源:Irregularity.php

示例7: __invoke

 public function __invoke($params)
 {
     $service = new PortableElementService();
     $service->setServiceLocator(ServiceManager::getServiceManager());
     $sourceDirectory = $this->getSourceDirectory();
     if (empty($sourceDirectory)) {
         return $this->createFailure('the source directory is empty');
     }
     if (!is_readable($sourceDirectory)) {
         return $this->createFailure('the source directory does not exists or is not readable ' . $sourceDirectory);
     }
     try {
         $model = $service->getValidPortableElementFromDirectorySource($sourceDirectory);
         if (!empty($params)) {
             $minRequiredVersion = $params[0];
             // if the minimal required version number string "x.y.z" is given in the parameter, the new target version should be equal or higher than it
             if (version_compare($model->getVersion(), $minRequiredVersion) < 0) {
                 return $this->createFailure('the version in manifest "' . $model->getVersion() . '" cannot be lower than the given minimum required version "' . $minRequiredVersion . '"', $model);
             }
         }
         $service->registerFromDirectorySource($sourceDirectory);
     } catch (PortableElementVersionIncompatibilityException $e) {
         return $this->createFailure('incompatible version: ' . $e->getMessage(), $model);
     }
     return Report::createSuccess('registered portable element "' . $model->getTypeIdentifier() . '" in version "' . $model->getVersion() . '""');
 }
开发者ID:oat-sa,项目名称:extension-tao-itemqti,代码行数:26,代码来源:RegisterPortableElement.php

示例8: __invoke

 public function __invoke($params)
 {
     $this->dryrun = in_array('dryrun', $params) || in_array('--dryrun', $params);
     /** @var StorageInterface $storageService */
     $storageService = ServiceManager::getServiceManager()->get(StorageInterface::SERVICE_ID);
     $page = 1;
     $rows = 500;
     $this->report = new \common_report_Report(\common_report_Report::TYPE_INFO, 'Converting of dates for the event log');
     while (true) {
         $slice = $storageService->searchInstances(['page' => $page, 'rows' => $rows]);
         if (!count($slice['data'])) {
             break;
         }
         foreach ($slice['data'] as $row) {
             if (empty($row['occurred']) || $row['occurred'] == '0000-00-00 00:00:00') {
                 $this->report->add(new \common_report_Report(\common_report_Report::TYPE_WARNING, 'Would not be converted date in id="' . $row['id'] . '" date is "' . $row['occurred'] . '"'));
                 continue;
             }
             if ($this->dryrun) {
                 $this->report->add(new \common_report_Report(\common_report_Report::TYPE_SUCCESS, 'Would be changed date "' . $row['occurred'] . '" to "' . $this->convertToUtcDate($row['occurred']) . '"'));
             } else {
                 $this->setOccurred($storageService, $row['id'], $this->convertToUtcDate($row['occurred']));
             }
         }
         if ($this->dryrun) {
             $this->report->add(new \common_report_Report(\common_report_Report::TYPE_SUCCESS, 'In the same way would be changed "' . $slice['records'] . '" records'));
             break;
         }
         $page++;
     }
     $this->report->add(new \common_report_Report(\common_report_Report::TYPE_SUCCESS, 'Done'));
     return $this->report;
 }
开发者ID:oat-sa,项目名称:extension-tao-eventlog,代码行数:33,代码来源:ConvertStoredTimezone.php

示例9: __invoke

 /**
  * @param $params
  */
 public function __invoke($params)
 {
     $serviceManager = ServiceManager::getServiceManager();
     $service = new CategoryService();
     $service->setServiceManager($serviceManager);
     $serviceManager->register(CategoryService::SERVICE_ID, $service);
 }
开发者ID:oat-sa,项目名称:extension-tao-item,代码行数:10,代码来源:RegisterCategoryService.php

示例10: setUp

 public function setUp()
 {
     \common_ext_ExtensionsManager::singleton()->getExtensionById('taoDelivery');
     TaoPhpUnitTestRunner::initTest();
     $this->service = ServiceManager::getServiceManager()->get(DeliveryMonitoringService::CONFIG_ID);
     $this->persistence = \common_persistence_Manager::getPersistence('default');
 }
开发者ID:oat-sa,项目名称:extension-tao-proctoring,代码行数:7,代码来源:DeliveryMonitoringServiceTest.php

示例11: __invoke

 /**
  * @param $params
  */
 public function __invoke($params)
 {
     $serviceManager = ServiceManager::getServiceManager();
     $testRunnerFeatureService = new TestRunnerFeatureService();
     $testRunnerFeatureService->setServiceManager($serviceManager);
     $serviceManager->register(TestRunnerFeatureService::SERVICE_ID, $testRunnerFeatureService);
 }
开发者ID:oat-sa,项目名称:extension-tao-test,代码行数:10,代码来源:RegisterTestRunnerFeatureService.php

示例12: install

 /**
  * install an extension
  *
  * @access public
  * @author Jerome Bogaerts, <jerome@taotesting.com>
  * @return void
  */
 public function install()
 {
     common_Logger::i('Installing extension ' . $this->extension->getId(), 'INSTALL');
     if ($this->extension->getId() == 'generis') {
         throw new common_ext_ForbiddenActionException('Tried to install generis using the ExtensionInstaller', $this->extension->getId());
     }
     if (common_ext_ExtensionsManager::singleton()->isInstalled($this->extension->getId())) {
         throw new common_ext_AlreadyInstalledException('Problem installing extension ' . $this->extension->getId() . ' : Already installed', $this->extension->getId());
     }
     // we purge the whole cache.
     $cache = common_cache_FileCache::singleton();
     $cache->purge();
     // check reuired extensions, throws exception if failed
     helpers_ExtensionHelper::checkRequiredExtensions($this->getExtension());
     $this->installLoadDefaultConfig();
     $this->installOntology();
     $this->installRegisterExt();
     common_Logger::d('Installing custom script for extension ' . $this->extension->getId());
     $this->installCustomScript();
     common_Logger::d('Done installing custom script for extension ' . $this->extension->getId());
     if ($this->getLocalData() == true) {
         common_Logger::d('Installing local data for extension ' . $this->extension->getId());
         $this->installLocalData();
         common_Logger::d('Done installing local data for extension ' . $this->extension->getId());
     }
     common_Logger::d('Extended install for extension ' . $this->extension->getId());
     // Method to be overriden by subclasses
     // to extend the installation mechanism.
     $this->extendedInstall();
     common_Logger::d('Done extended install for extension ' . $this->extension->getId());
     $eventManager = ServiceManager::getServiceManager()->get(EventManager::CONFIG_ID);
     $eventManager->trigger(new common_ext_event_ExtensionInstalled($this->extension));
 }
开发者ID:oat-sa,项目名称:generis,代码行数:40,代码来源:class.ExtensionInstaller.php

示例13: inject

 public function inject($target, array $values)
 {
     if (!$target instanceof core_kernel_classes_Resource) {
         $msg = "The given target is not an instance of core_kernel_classes_Resource.";
         throw new MetadataInjectionException($msg);
     }
     $injectionRules = $this->getInjectionRules();
     foreach ($values as $metadataValues) {
         foreach ($metadataValues as $metadataValue) {
             $pathKey = implode('->', $metadataValue->getPath());
             $lang = $metadataValue->getLanguage() ?: DEFAULT_LANG;
             if (($rule = $this->getRuleByValue($metadataValue->getPath(), $metadataValue->getValue())) !== false) {
                 // Direct Mapping.
                 $target->setPropertyValueByLg(new core_kernel_classes_Property($rule[0]), $rule[2], $lang);
             } elseif (($rule = $this->getRuleByPath($metadataValue->getPath())) !== false) {
                 // Direct Injection.
                 $target->setPropertyValueByLg(new core_kernel_classes_Property($rule[0]), $metadataValue->getValue(), $lang);
             }
             $eventManager = ServiceManager::getServiceManager()->get(EventManager::CONFIG_ID);
             $metadata = $metadataValue->getPath();
             $metadataUri = array_pop($metadata);
             $eventManager->trigger(new MetadataModified($target, $metadataUri, $metadataValue->getValue()));
         }
     }
 }
开发者ID:oat-sa,项目名称:extension-tao-itemqti,代码行数:25,代码来源:OntologyMetadataInjector.php

示例14: __invoke

 /**
  * @param $params
  */
 public function __invoke($params)
 {
     $serviceManager = ServiceManager::getServiceManager();
     $eventManager = $serviceManager->get(EventManager::CONFIG_ID);
     $eventManager->attach('oat\\taoTests\\models\\event\\TestExecutionPausedEvent', ['oat\\taoProctoring\\model\\implementation\\DeliveryExecutionStateService', 'catchSessionPause']);
     $serviceManager->register(EventManager::CONFIG_ID, $eventManager);
 }
开发者ID:oat-sa,项目名称:extension-tao-proctoring,代码行数:10,代码来源:RegisterSessionStateListener.php

示例15: getPersistence

 public function getPersistence()
 {
     if (is_null($this->persistence)) {
         $this->persistence = ServiceManager::getServiceManager()->get(\common_persistence_Manager::SERVICE_KEY)->getPersistenceById($this->getOption('persistence'));
     }
     return $this->persistence;
 }
开发者ID:oat-sa,项目名称:extension-tao-revision,代码行数:7,代码来源:Storage.php


注:本文中的oat\oatbox\service\ServiceManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。