@@ -32,7 +32,6 @@ |
||
32 | 32 | |
33 | 33 | /** |
34 | 34 | * |
35 | - * @param type $config_files |
|
36 | 35 | * @todo user %paths.base% value |
37 | 36 | */ |
38 | 37 | private function loadConfigFiles($configs_mapping){ |
@@ -62,7 +62,7 @@ |
||
62 | 62 | |
63 | 63 | public function getFilePath($key) |
64 | 64 | { |
65 | - if (key_exists($key, $this->configs)) { |
|
65 | + if (key_exists($key, $this->configs)) { |
|
66 | 66 | return $this->configs[$key]['path']; |
67 | 67 | } |
68 | 68 | return null; |
@@ -3,7 +3,6 @@ |
||
3 | 3 | |
4 | 4 | use Symfony\Component\Yaml\Yaml; |
5 | 5 | use Ciandt\Behat\PlaceholdersExtension\Utils\PlaceholderUtils; |
6 | -use Ciandt\Behat\PlaceholdersExtension\PlaceholderContainer\PlaceholderContainer; |
|
7 | 6 | use Ciandt\Behat\PlaceholdersExtension\Exception\MissingSectionException; |
8 | 7 | use Ciandt\Behat\PlaceholdersExtension\Exception\UndefinedPlaceholderException; |
9 | 8 |
@@ -109,9 +109,9 @@ |
||
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
112 | - private function getSectionPlaceholders($configKey, $section){ |
|
112 | + private function getSectionPlaceholders($configKey, $section) { |
|
113 | 113 | $config = $this->getConfig($configKey); |
114 | - if (!key_exists($section, $config)){ |
|
114 | + if (!key_exists($section, $config)) { |
|
115 | 115 | throw new MissingSectionException( |
116 | 116 | $configKey, |
117 | 117 | $this->getFilePath($configKey), |
@@ -25,6 +25,9 @@ |
||
25 | 25 | return self::USER_DEFINED_PLACEHOLDER_REGEX; |
26 | 26 | } |
27 | 27 | |
28 | + /** |
|
29 | + * @param string $string |
|
30 | + */ |
|
28 | 31 | private static function replaceStringPlaceholders($string, PlaceholdersRepository $repository, PlaceholderContainerStepNode $container) { |
29 | 32 | preg_match_all(self::USER_DEFINED_PLACEHOLDER_REGEX, $string, $matches, PREG_SET_ORDER); |
30 | 33 | foreach ($matches as $match) { |
@@ -3,11 +3,9 @@ |
||
3 | 3 | |
4 | 4 | namespace Ciandt\Behat\PlaceholdersExtension\Transformation; |
5 | 5 | |
6 | -use Behat\Behat\Definition\Call\DefinitionCall; |
|
7 | 6 | use Behat\Gherkin\Node\TableNode; |
8 | 7 | use Behat\Testwork\Call\RuntimeCallee; |
9 | 8 | use Ciandt\Behat\PlaceholdersExtension\Config\PlaceholdersRepository; |
10 | -use Ciandt\Behat\PlaceholdersExtension\PlaceholderContainer\PlaceholderContainer; |
|
11 | 9 | use Ciandt\Behat\PlaceholdersExtension\PlaceholderContainer\PlaceholderContainerStepNode; |
12 | 10 | |
13 | 11 | /** |
@@ -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,6 @@ |
||
10 | 10 | |
11 | 11 | /** |
12 | 12 | * Transforms a single argument value. |
13 | - |
|
14 | 13 | */ |
15 | 14 | class PlaceholdersTransformer implements ArgumentTransformer |
16 | 15 | { |
@@ -32,7 +32,7 @@ |
||
32 | 32 | public function transformArgument(DefinitionCall $definitionCall, $argumentIndex, $argumentValue) { |
33 | 33 | $tags = $this->beforeScenarioSubscriber->getScenarioTags(); |
34 | 34 | $transformedArgument = $argumentValue; |
35 | - if (RuntimePlaceholdersTransformation::supportsDefinitionAndArgument($tags, $argumentValue)){ |
|
35 | + if (RuntimePlaceholdersTransformation::supportsDefinitionAndArgument($tags, $argumentValue)) { |
|
36 | 36 | $transformedArgument = RuntimePlaceholdersTransformation::transformArgument( |
37 | 37 | $transformedArgument, |
38 | 38 | $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 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $container->setDefinition(self::PLACEHOLDERS_CONTROLLER_ID, $definition); |
99 | 99 | } |
100 | 100 | |
101 | - protected function initializePlaceholderUtils($variantTags,$configTags){ |
|
101 | + protected function initializePlaceholderUtils($variantTags, $configTags) { |
|
102 | 102 | PlaceholderUtils::setVariantTags($variantTags); |
103 | 103 | PlaceholderUtils::setConfigKeys(array_keys($configTags)); |
104 | 104 | } |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | $container->setDefinition(self::STEPS_DECORATOR_ID, $definition); |
157 | 157 | } |
158 | 158 | |
159 | - protected function loadBeforeScenarioSubscriber(ContainerBuilder $container){ |
|
159 | + protected function loadBeforeScenarioSubscriber(ContainerBuilder $container) { |
|
160 | 160 | $definition = new Definition('Ciandt\Behat\PlaceholdersExtension\Subscriber\BeforeScenarioSubscriber'); |
161 | 161 | $definition->addTag(EventDispatcherExtension::SUBSCRIBER_TAG, array('priority' => 0)); |
162 | 162 | $container->setDefinition(self::BEFORE_SCENARIO_SUBSCRIBER_ID, $definition); |
@@ -31,7 +31,7 @@ |
||
31 | 31 | ); |
32 | 32 | } |
33 | 33 | |
34 | - public function onBeforeScenarioTested($beforeScenario){ |
|
34 | + public function onBeforeScenarioTested($beforeScenario) { |
|
35 | 35 | $featureTags = $beforeScenario->getFeature()->getTags(); |
36 | 36 | $scenarioTags = $beforeScenario->getNode()->getTags(); |
37 | 37 | $this->scenarioTags = array_merge($featureTags, $scenarioTags); |