Skip to content
Snippets Groups Projects
Unverified Commit 623b6612 authored by LukasKiederle's avatar LukasKiederle Committed by GitHub
Browse files

Merge pull request #34 from ffalkone/develop

Remove 'Introduce Export Definition to Dump Entries' in order to have clean develop branch
parents 57bc9276 2957248f
Branches
Tags 1.3.1
No related merge requests found
<?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 register or to comment