From 06eca792ca971acb6197ff92a4ef9320d89a13de Mon Sep 17 00:00:00 2001 From: thokiller <35527212+thokiller@users.noreply.github.com> Date: Thu, 29 Nov 2018 15:18:22 +0100 Subject: [PATCH 1/4] Added check function createPhrase --- Module/I18n/Factory.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Module/I18n/Factory.php b/Module/I18n/Factory.php index bc8421f..8e2349c 100755 --- a/Module/I18n/Factory.php +++ b/Module/I18n/Factory.php @@ -65,12 +65,14 @@ public function createDictionary() */ public function createPhrase(array $data) { + if("" != $data['phrase']){ return new Dictionary\Phrase( $data['phrase'], $data['translation'], isset($data['context_type']) ? $data['context_type'] : null, isset($data['context_value']) ? $data['context_value'] : null, isset($data['quote']) ? $data['quote'] : null - ); + ); + } } } From 9626bc3ed4a9b564daec36d4f990bfc9b0ec8829 Mon Sep 17 00:00:00 2001 From: thokiller <35527212+thokiller@users.noreply.github.com> Date: Thu, 29 Nov 2018 15:20:33 +0100 Subject: [PATCH 2/4] added instance check Phrase --- Module/I18n/Dictionary/Generator.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Module/I18n/Dictionary/Generator.php b/Module/I18n/Dictionary/Generator.php index 6e2ac6c..62c1888 100755 --- a/Module/I18n/Dictionary/Generator.php +++ b/Module/I18n/Dictionary/Generator.php @@ -96,7 +96,9 @@ public function generate($directory, $outputFilename, $withContext = false, $loc throw new \UnexpectedValueException('No phrases found in the specified dictionary file.'); } foreach ($phraseList as $phrase) { + if($phrase instanceof Phrase){ $this->getDictionaryWriter($outputFilename, $delimiter, $enclosure)->write($phrase); + } } $this->writer = null; } From 7c61a16c3d8fa68f201e83ff4b2b2c5b6767bf71 Mon Sep 17 00:00:00 2001 From: thokiller <35527212+thokiller@users.noreply.github.com> Date: Thu, 29 Nov 2018 15:30:55 +0100 Subject: [PATCH 3/4] Fixed indent on file Factory.php --- Module/I18n/Factory.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Module/I18n/Factory.php b/Module/I18n/Factory.php index 8e2349c..03a74c8 100755 --- a/Module/I18n/Factory.php +++ b/Module/I18n/Factory.php @@ -8,6 +8,7 @@ * http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * Please see LICENSE.txt for the full text of the OSL 3.0 license */ + namespace Experius\MissingTranslations\Module\I18n; /** @@ -65,13 +66,13 @@ public function createDictionary() */ public function createPhrase(array $data) { - if("" != $data['phrase']){ - return new Dictionary\Phrase( - $data['phrase'], - $data['translation'], - isset($data['context_type']) ? $data['context_type'] : null, - isset($data['context_value']) ? $data['context_value'] : null, - isset($data['quote']) ? $data['quote'] : null + if ("" != $data['phrase']) { + return new Dictionary\Phrase( + $data['phrase'], + $data['translation'], + isset($data['context_type']) ? $data['context_type'] : null, + isset($data['context_value']) ? $data['context_value'] : null, + isset($data['quote']) ? $data['quote'] : null ); } } From eea77d1cbcd18dff233ceecef2ab30843dd90bfb Mon Sep 17 00:00:00 2001 From: thokiller <35527212+thokiller@users.noreply.github.com> Date: Thu, 29 Nov 2018 15:31:33 +0100 Subject: [PATCH 4/4] fixed indent on generator.php --- Module/I18n/Dictionary/Generator.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Module/I18n/Dictionary/Generator.php b/Module/I18n/Dictionary/Generator.php index 62c1888..3989829 100755 --- a/Module/I18n/Dictionary/Generator.php +++ b/Module/I18n/Dictionary/Generator.php @@ -65,7 +65,8 @@ public function __construct( ParserInterface $contextualParser, Factory $factory, Options\ResolverFactory $optionsResolver - ) { + ) + { $this->parser = $parser; $this->contextualParser = $contextualParser; $this->factory = $factory; @@ -96,8 +97,8 @@ public function generate($directory, $outputFilename, $withContext = false, $loc throw new \UnexpectedValueException('No phrases found in the specified dictionary file.'); } foreach ($phraseList as $phrase) { - if($phrase instanceof Phrase){ - $this->getDictionaryWriter($outputFilename, $delimiter, $enclosure)->write($phrase); + if ($phrase instanceof Phrase) { + $this->getDictionaryWriter($outputFilename, $delimiter, $enclosure)->write($phrase); } } $this->writer = null;