forked from php-enqueue/enqueue-dev
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArrayProcessorRegistry.php
More file actions
42 lines (35 loc) · 904 Bytes
/
ArrayProcessorRegistry.php
File metadata and controls
42 lines (35 loc) · 904 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
namespace Enqueue\Client;
use Interop\Queue\PsrProcessor;
class ArrayProcessorRegistry implements ProcessorRegistryInterface
{
/**
* @var PsrProcessor[]
*/
private $processors;
/**
* @param PsrProcessor[] $processors
*/
public function __construct(array $processors = [])
{
$this->processors = $processors;
}
/**
* @param string $name
* @param PsrProcessor $processor
*/
public function add($name, PsrProcessor $processor)
{
$this->processors[$name] = $processor;
}
/**
* {@inheritdoc}
*/
public function get($processorName)
{
if (false == isset($this->processors[$processorName])) {
throw new \LogicException(sprintf('Processor was not found. processorName: "%s"', $processorName));
}
return $this->processors[$processorName];
}
}