Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
M2 content provisioning
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TechDivision Public
M2 content provisioning
Commits
1361f8bb
Commit
1361f8bb
authored
5 years ago
by
Vadim Justus
Browse files
Options
Downloads
Patches
Plain Diff
Implement strategy provider logic
parent
c3f9816f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Model/Strategy/Provider.php
+11
-1
11 additions, 1 deletion
Model/Strategy/Provider.php
with
11 additions
and
1 deletion
Model/Strategy/Provider.php
+
11
−
1
View file @
1361f8bb
...
...
@@ -5,6 +5,7 @@ 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
...
...
@@ -17,9 +18,18 @@ class Provider implements StrategyProviderInterface
/**
* 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
;
}
...
...
@@ -34,7 +44,7 @@ class Provider implements StrategyProviderInterface
$strategy
=
$this
->
strategies
[
$strategyCode
]
??
null
;
if
(
!
$strategy
)
{
throw
new
NotFoundException
(
__
(
'Strategy %s not found.'
,
$strategyCode
));
throw
new
NotFoundException
(
__
(
'Strategy %s
trategy_code
not found.'
,
[
'strategy_code'
=>
$strategyCode
]
));
}
return
$strategy
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment