for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is a part of Sculpin.
*
* (c) Dragonfly Development Inc.
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symplify\PHP7_Sculpin\Source;
final class CompositeDataSource implements DataSourceInterface
{
/**
* Data sources.
* @var array
private $dataSources = [];
* Constructor.
* @param array $dataSources Data sources
public function __construct(array $dataSources = [])
foreach ($dataSources as $dataSource) {
$this->dataSources[$dataSource->dataSourceId()] = $dataSource;
}
* Add a Data Source.
* @param DataSourceInterface $dataSource Data Source
public function addDataSource(DataSourceInterface $dataSource)
* Backing Data Sources.
* @return array
public function dataSources()
return $this->dataSources;
* {@inheritdoc}
public function dataSourceId()
return 'CompositeDataSource('.implode(',', array_map(function ($dataSource) {
return $dataSource->dataSourceId();
}, $this->dataSources));
public function refresh(SourceSet $sourceSet)
foreach ($this->dataSources as $dataSource) {
$dataSource->refresh($sourceSet);