@@ -9,7 +9,7 @@ |
||
9 | 9 | * |
10 | 10 | * @author bwowk |
11 | 11 | */ |
12 | -class MissingSectionException extends RuntimeException{ |
|
12 | +class MissingSectionException extends RuntimeException { |
|
13 | 13 | |
14 | 14 | |
15 | 15 | public function __construct($configKey, $configPath, $section) { |
@@ -8,6 +8,6 @@ |
||
8 | 8 | * |
9 | 9 | * @author bwowk |
10 | 10 | */ |
11 | -class UndefinedPlaceholderException extends RuntimeException{ |
|
11 | +class UndefinedPlaceholderException extends RuntimeException { |
|
12 | 12 | //put your code here |
13 | 13 | } |
@@ -9,7 +9,7 @@ |
||
9 | 9 | * |
10 | 10 | * @author bwowk |
11 | 11 | */ |
12 | -class RedundantConfigTagException extends RuntimeException{ |
|
12 | +class RedundantConfigTagException extends RuntimeException { |
|
13 | 13 | public function __construct($tags) { |
14 | 14 | $message = "Multiple config tags found. Should have only one: " . implode(', ', $tags); |
15 | 15 | parent::__construct($message); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * |
11 | 11 | * @author bwowk |
12 | 12 | */ |
13 | -class PlaceholderContainerStepNode extends StepNode implements PlaceholderContainer{ |
|
13 | +class PlaceholderContainerStepNode extends StepNode implements PlaceholderContainer { |
|
14 | 14 | |
15 | 15 | private $stepNode; |
16 | 16 | |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | private $sectionKey; |
22 | 22 | |
23 | - function __construct($stepNode,$configKey, $sectionKey, $variant) { |
|
23 | + function __construct($stepNode, $configKey, $sectionKey, $variant) { |
|
24 | 24 | $this->stepNode = $stepNode; |
25 | 25 | $this->configKey = $configKey; |
26 | 26 | $this->sectionKey = $sectionKey; |
@@ -107,11 +107,11 @@ |
||
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
110 | - private function getSectionPlaceholders(PlaceholderContainer $container){ |
|
110 | + private function getSectionPlaceholders(PlaceholderContainer $container) { |
|
111 | 111 | $configKey = $container->getConfigKey(); |
112 | 112 | $config = $this->getConfig($configKey); |
113 | 113 | $sectionKey = $container->getSectionKey(); |
114 | - if (!key_exists($sectionKey, $config)){ |
|
114 | + if (!key_exists($sectionKey, $config)) { |
|
115 | 115 | throw new MissingSectionException( |
116 | 116 | $configKey, |
117 | 117 | $this->getFilePath($configKey), |
@@ -101,7 +101,7 @@ |
||
101 | 101 | $container->setDefinition(self::PLACEHOLDERS_CONTROLLER_ID, $definition); |
102 | 102 | } |
103 | 103 | |
104 | - protected function initializePlaceholderUtils($variantTags,$configTags){ |
|
104 | + protected function initializePlaceholderUtils($variantTags, $configTags) { |
|
105 | 105 | PlaceholderUtils::setVariantTags($variantTags); |
106 | 106 | PlaceholderUtils::setConfigKeys(array_keys($configTags)); |
107 | 107 | } |
@@ -28,7 +28,7 @@ |
||
28 | 28 | |
29 | 29 | public function transformArgument(DefinitionCall $definitionCall, $argumentIndex, $argumentValue) { |
30 | 30 | $transformedArgument = $argumentValue; |
31 | - if (RuntimePlaceholdersTransformation::supportsDefinitionAndArgument($definitionCall, $argumentValue)){ |
|
31 | + if (RuntimePlaceholdersTransformation::supportsDefinitionAndArgument($definitionCall, $argumentValue)) { |
|
32 | 32 | $transformedArgument = RuntimePlaceholdersTransformation::transformArgument( |
33 | 33 | $transformedArgument, |
34 | 34 | $this->placeholdersRepository, |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | self::$configKeys = $configKeys; |
26 | 26 | } |
27 | 27 | |
28 | - public static function getSectionKey($tag){ |
|
28 | + public static function getSectionKey($tag) { |
|
29 | 29 | $tagParts = explode(':', $tag); |
30 | - if (count($tagParts) == 2){ |
|
30 | + if (count($tagParts) == 2) { |
|
31 | 31 | return $tagParts[1]; |
32 | 32 | } else { |
33 | 33 | return 'default'; |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | |
36 | 36 | } |
37 | 37 | |
38 | - public static function getConfigTag($tags){ |
|
39 | - $configTags = self::filterConfigTags($tags,false); |
|
38 | + public static function getConfigTag($tags) { |
|
39 | + $configTags = self::filterConfigTags($tags, false); |
|
40 | 40 | if (empty($configTags)) { |
41 | 41 | return false; |
42 | 42 | } |
@@ -47,25 +47,25 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | |
50 | - public static function getConfigKey($tag){ |
|
50 | + public static function getConfigKey($tag) { |
|
51 | 51 | return explode(':', $tag)[0]; |
52 | 52 | } |
53 | 53 | |
54 | 54 | |
55 | 55 | public static function filterVariantTags($tags, $exclude) |
56 | 56 | { |
57 | - return array_filter($tags, function ($tag) use ($exclude) { |
|
57 | + return array_filter($tags, function($tag) use ($exclude) { |
|
58 | 58 | return (in_array($tag, self::$variantTags) xor $exclude); |
59 | 59 | }); |
60 | 60 | } |
61 | 61 | |
62 | - public static function getVariant($tags){ |
|
62 | + public static function getVariant($tags) { |
|
63 | 63 | $variantTags = self::filterVariantTags($tags, false); |
64 | 64 | if (count($variantTags) > 1) { |
65 | 65 | throw new \RuntimeException("Scenario should only have one variant tag." |
66 | 66 | . " Multiple found: " . implode(', ', $variantTags)); |
67 | 67 | } |
68 | - if (empty($variantTags)){ |
|
68 | + if (empty($variantTags)) { |
|
69 | 69 | return 'default'; |
70 | 70 | } |
71 | 71 | return end($variantTags); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | |
75 | 75 | public static function filterConfigTags($tags, $exclude) |
76 | 76 | { |
77 | - return array_filter($tags, function ($tag) use ($exclude){ |
|
77 | + return array_filter($tags, function($tag) use ($exclude){ |
|
78 | 78 | return (in_array(self::getConfigKey($tag), self::$configKeys) xor $exclude); |
79 | 79 | }); |
80 | 80 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $scenarios = array(); |
76 | 76 | |
77 | 77 | foreach ($feature->getScenarios() as $scenario) { |
78 | - $scenarios = array_merge($scenarios,$this->splitScenarioPerVariants($scenario,$feature)); |
|
78 | + $scenarios = array_merge($scenarios, $this->splitScenarioPerVariants($scenario, $feature)); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | return new FeatureNode( |
@@ -91,12 +91,12 @@ discard block |
||
91 | 91 | ); |
92 | 92 | } |
93 | 93 | |
94 | - private function splitScenarioPerVariants(ScenarioNode $scenario, FeatureNode $feature){ |
|
94 | + private function splitScenarioPerVariants(ScenarioNode $scenario, FeatureNode $feature) { |
|
95 | 95 | $scenarioTags = $scenario->getTags(); |
96 | 96 | $featureTags = $feature->getTags(); |
97 | - $tags = array_merge($scenarioTags,$featureTags); |
|
97 | + $tags = array_merge($scenarioTags, $featureTags); |
|
98 | 98 | |
99 | - $variants = PlaceholderUtils::filterVariantTags($tags,false); |
|
99 | + $variants = PlaceholderUtils::filterVariantTags($tags, false); |
|
100 | 100 | |
101 | 101 | if (count($variants) <= 1) { |
102 | 102 | return array($scenario); |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | private function forkScenario(ScenarioNode $scenario, $variants) |
110 | 110 | { |
111 | 111 | $scenarios = array(); |
112 | - $nonVariantTags = PlaceholderUtils::filterVariantTags($scenario->getTags(),true); |
|
112 | + $nonVariantTags = PlaceholderUtils::filterVariantTags($scenario->getTags(), true); |
|
113 | 113 | foreach ($variants as $variant) { |
114 | 114 | $tags = array_merge($nonVariantTags, array($variant)); |
115 | 115 | $scenarios[] = new ScenarioNode( |