Skip to content
Snippets Groups Projects
Commit 2957248f authored by Falk Ulbricht's avatar Falk Ulbricht
Browse files

Remove 'Introduce Export Definition to Dump Entries' in order to have clean develop branch

parent 57bc9276
Branches
Tags
1 merge request!34Remove 'Introduce Export Definition to Dump Entries' in order to have clean develop branch
<?php
declare(strict_types=1);
namespace Firegento\ContentProvisioning\Model\Strategy;
use Firegento\ContentProvisioning\Api\StrategyInterface;
class ExportToModule implements StrategyInterface
{
/**
* @return string
*/
public function getTargetPath(): string
{
// TODO: Implement getTargetPath() method.
}
}
<?php
declare(strict_types=1);
namespace Firegento\ContentProvisioning\Model\Strategy;
use Firegento\ContentProvisioning\Api\StrategyInterface;
class ExportToVar implements StrategyInterface
{
/**
* @return string
*/
public function getTargetPath(): string
{
// TODO: Implement getTargetPath() method.
}
}
<?php
declare(strict_types=1);
namespace Firegento\ContentProvisioning\Model\Strategy;
use Firegento\ContentProvisioning\Api\StrategyInterface;
use Firegento\ContentProvisioning\Api\StrategyProviderInterface;
use Magento\Framework\Exception\InputException;
use Magento\Framework\Exception\NotFoundException;
class Provider implements StrategyProviderInterface
{
/**
* @var array|StrategyInterface[]
*/
private $strategies;
/**
* Provider constructor.
* @param StrategyInterface[] $strategies
* @throws InputException
*/
public function __construct(array $strategies)
{
foreach ($strategies as $strategy) {
if (!($strategy instanceof StrategyInterface)) {
throw new InputException(__(
'Strategy must be instance of %interface',
['interface' => StrategyInterface::class]
));
}
}
$this->strategies = $strategies;
}
/**
* @param string $strategyCode
* @return StrategyInterface
*
* @throws NotFoundException
*/
public function get(string $strategyCode): StrategyInterface
{
$strategy = $this->strategies[$strategyCode] ?? null;
if (!$strategy) {
throw new NotFoundException(__('Strategy %strategy_code not found.', ['strategy_code' => $strategyCode]));
}
return $strategy;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment