| @@ 19-52 (lines=34) @@ | ||
| 16 | /** |
|
| 17 | * Returns index and type configuration from the container. |
|
| 18 | */ |
|
| 19 | class ContainerSource implements SourceInterface |
|
| 20 | { |
|
| 21 | /** |
|
| 22 | * The internal container representation of information. |
|
| 23 | * |
|
| 24 | * @var array |
|
| 25 | */ |
|
| 26 | private $configArray; |
|
| 27 | ||
| 28 | public function __construct(array $configArray) |
|
| 29 | { |
|
| 30 | $this->configArray = $configArray; |
|
| 31 | } |
|
| 32 | ||
| 33 | /** |
|
| 34 | * Should return all configuration available from the data source. |
|
| 35 | * |
|
| 36 | * @return IndexConfig[] |
|
| 37 | */ |
|
| 38 | public function getConfiguration() |
|
| 39 | { |
|
| 40 | $indexes = []; |
|
| 41 | foreach ($this->configArray as $config) { |
|
| 42 | $index = new IndexConfig($config); |
|
| 43 | $indexes[$config['name']] = $index; |
|
| 44 | } |
|
| 45 | ||
| 46 | return $indexes; |
|
| 47 | } |
|
| 48 | } |
|
| 49 | ||
| @@ 19-49 (lines=31) @@ | ||
| 16 | /** |
|
| 17 | * Returns index and type configuration from the container. |
|
| 18 | */ |
|
| 19 | class TemplateContainerSource implements SourceInterface |
|
| 20 | { |
|
| 21 | /** |
|
| 22 | * The internal container representation of information. |
|
| 23 | * |
|
| 24 | * @var array |
|
| 25 | */ |
|
| 26 | private $configArray; |
|
| 27 | ||
| 28 | public function __construct(array $configArray) |
|
| 29 | { |
|
| 30 | $this->configArray = $configArray; |
|
| 31 | } |
|
| 32 | ||
| 33 | /** |
|
| 34 | * Should return all configuration available from the data source. |
|
| 35 | * |
|
| 36 | * @return IndexTemplateConfig[] |
|
| 37 | */ |
|
| 38 | public function getConfiguration() |
|
| 39 | { |
|
| 40 | $indexes = []; |
|
| 41 | foreach ($this->configArray as $config) { |
|
| 42 | $index = new IndexTemplateConfig($config); |
|
| 43 | ||
| 44 | $indexes[$config['name']] = $index; |
|
| 45 | } |
|
| 46 | ||
| 47 | return $indexes; |
|
| 48 | } |
|
| 49 | } |
|
| 50 | ||