Пример #1
0
 /**
  * @param string $queueName
  * @return QueueInterface
  * @throws JobQueueException
  */
 public function getQueue($queueName)
 {
     if (!isset($this->queues[$queueName])) {
         $settings = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['jobqueue'];
         $className = $this->extensionConfiguration->get('defaultQueue');
         $options = [];
         if (isset($settings[$queueName])) {
             $className = isset($settings[$queueName]['className']) ? $settings[$queueName]['className'] : null;
             $options = isset($settings[$queueName]['options']) ? (array) $settings[$queueName]['options'] : [];
         }
         if (empty($options)) {
             $options = isset($settings[$className]['options']) ? (array) $settings[$className]['options'] : [];
         }
         if (!isset($options['timeout'])) {
             $defaultTimeout = (int) $this->extensionConfiguration->get('defaultTimeout');
             $options['timeout'] = $defaultTimeout > 0 ? $defaultTimeout : null;
         }
         if (empty($className)) {
             throw new JobQueueException('No jobqueue class name configuration found.', 1448488276);
         }
         $classNameParts = ClassNamingUtility::explode($className);
         ExtensionManagementUtility::isLoaded(GeneralUtility::camelCaseToLowerCaseUnderscored($classNameParts['extensionName']), true);
         $queue = $this->objectManager->get($className, $queueName, $options);
         if (!$queue instanceof QueueInterface) {
             throw new JobQueueException("Queue '{$queueName}' is not a queue.", 1446318455);
         }
         $this->queues[$queueName] = $queue;
     }
     return $this->queues[$queueName];
 }
 /**
  * @test
  * @dataProvider explodeDataProvider
  */
 public function explode($expected, $className)
 {
     $this->assertArraySubset($expected, ClassNamingUtility::explode($className), "Failed for '{$className}'!");
 }