From d42302cc505191a7ea4dc1705bfc8b3f8e91190d Mon Sep 17 00:00:00 2001 From: vol4onok Date: Fri, 4 Aug 2023 11:50:42 +0300 Subject: [PATCH 1/4] SDK-2896: Wrap to quotes glossary values --- composer.json | 2 +- src/ManifestStrategy/GlossaryManifestStrategy.php | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 85adb7e4..0b0a7a97 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "ext-zip": "*", "phpstan/phpstan": "^1.0.0", "phpunit/phpunit": "^9.5.0", - "spryker-sdk/manifest-test-data-provider": "dev-master", + "spryker-sdk/manifest-test-data-provider": "dev-bugfix/sdk-2896-glossary-quotes", "spryker/code-sniffer": "dev-master", "symfony/filesystem": "^5.3.0 || ^6.0" }, diff --git a/src/ManifestStrategy/GlossaryManifestStrategy.php b/src/ManifestStrategy/GlossaryManifestStrategy.php index d0a51482..40dece86 100644 --- a/src/ManifestStrategy/GlossaryManifestStrategy.php +++ b/src/ManifestStrategy/GlossaryManifestStrategy.php @@ -149,11 +149,21 @@ protected function createGlossaryFileLine(string $glossaryKey, string $glossaryK { return implode(',', [ $glossaryKey, - $glossaryKeyValue, + $this->wrapInQuotes($glossaryKeyValue), $glossaryKeyLanguage, ]); } + /** + * @param string $string + * + * @return string + */ + protected function wrapInQuotes(string $string): string + { + return sprintf('"%s"', $string); + } + /** * @param array $glossaryExistingFileLines * From 533f14e54ee4981ad7d60e93440d94c36b00dadb Mon Sep 17 00:00:00 2001 From: vol4onok Date: Fri, 4 Aug 2023 15:09:46 +0300 Subject: [PATCH 2/4] SDK-2896: Adjusted glossary strategy --- src/ManifestStrategy/GlossaryManifestStrategy.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ManifestStrategy/GlossaryManifestStrategy.php b/src/ManifestStrategy/GlossaryManifestStrategy.php index 40dece86..266936f0 100644 --- a/src/ManifestStrategy/GlossaryManifestStrategy.php +++ b/src/ManifestStrategy/GlossaryManifestStrategy.php @@ -161,7 +161,7 @@ protected function createGlossaryFileLine(string $glossaryKey, string $glossaryK */ protected function wrapInQuotes(string $string): string { - return sprintf('"%s"', $string); + return (strpos($string, ',')) ? sprintf('"%s"', $string) : $string; } /** From c1cd552bb2f5d19acbe74816ad3298605a2597cd Mon Sep 17 00:00:00 2001 From: vol4onok Date: Fri, 4 Aug 2023 15:11:18 +0300 Subject: [PATCH 3/4] SDK-2896: Adjusted glossary strategy --- src/ManifestStrategy/GlossaryManifestStrategy.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ManifestStrategy/GlossaryManifestStrategy.php b/src/ManifestStrategy/GlossaryManifestStrategy.php index 266936f0..8fb47b9e 100644 --- a/src/ManifestStrategy/GlossaryManifestStrategy.php +++ b/src/ManifestStrategy/GlossaryManifestStrategy.php @@ -161,7 +161,7 @@ protected function createGlossaryFileLine(string $glossaryKey, string $glossaryK */ protected function wrapInQuotes(string $string): string { - return (strpos($string, ',')) ? sprintf('"%s"', $string) : $string; + return strpos($string, ',') !== false ? sprintf('"%s"', $string) : $string; } /** From d80138aebb73357738aabec13a813c6970585bab Mon Sep 17 00:00:00 2001 From: Dmytro Klyman Date: Mon, 7 Aug 2023 12:59:04 +0200 Subject: [PATCH 4/4] SDK-2896: Update manifests provider branch --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 0b0a7a97..85adb7e4 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "ext-zip": "*", "phpstan/phpstan": "^1.0.0", "phpunit/phpunit": "^9.5.0", - "spryker-sdk/manifest-test-data-provider": "dev-bugfix/sdk-2896-glossary-quotes", + "spryker-sdk/manifest-test-data-provider": "dev-master", "spryker/code-sniffer": "dev-master", "symfony/filesystem": "^5.3.0 || ^6.0" },