diff --git a/.travis.yml b/.travis.yml index 3253fb57..c19a0fb0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,6 @@ php: - 5.6 - 7.0 - 7.1 - - hhvm env: global: diff --git a/Changelog.md b/Changelog.md index a6028d1b..c49b9799 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,9 +1,13 @@ # Change Log -The change log describes what is "Added", "Removed", "Changed" or "Fixed" between each release. +The change log describes what is "Added", "Removed", "Changed" or "Fixed" between each release. ## UNRELEASED +### Changed + +- Add meta informations from the profiler to `Translation\Common\Model\Message` + ## 0.3.2 ### Changed @@ -58,19 +62,19 @@ The change log describes what is "Added", "Removed", "Changed" or "Fixed" betwee ### Changed - `Translation\Bundle\Service\CatalogueFetcher` moved to `Translation\Bundle\Catalogue\CatalogueFetcher` -- Made most (if not all) classes final. +- Made most (if not all) classes final. - `CatalogueFetcher` requires a `Configuration` object. ### Removed - Dead code in the `SymfonyProfilerController` -- `FileStorage` was moved to `php-translation/symfony-storage` +- `FileStorage` was moved to `php-translation/symfony-storage` ### Fixed -- The bundle works without any configuration. +- The bundle works without any configuration. - You may have an config named "default". ## 0.1.0 -First release. +First release. diff --git a/Model/SfProfilerMessage.php b/Model/SfProfilerMessage.php index 86df4f5c..1835702b 100644 --- a/Model/SfProfilerMessage.php +++ b/Model/SfProfilerMessage.php @@ -116,20 +116,36 @@ public static function create(array $data) return $message; } - /** - * Convert to a Common\Message. - * - * @return Message - */ - public function convertToMessage() - { - return new Message( - $this->key, - $this->domain, - $this->locale, - $this->translation - ); - } + /** + * Convert to a Common\Message. + * + * @return Message + */ + public function convertToMessage() + { + $meta = []; + + if (!empty($this->getParameters())) { + // Reduce to only get one value of each parameter, not all the usages. + $meta['parameters'] = array_reduce($this->getParameters(), 'array_merge', []); + } + + if (!empty($this->getCount())) { + $meta['count'] = $this->getCount(); + } + + if (!empty($this->getTransChoiceNumber())) { + $meta['transChoiceNumber'] = $this->getTransChoiceNumber(); + } + + return new Message( + $this->key, + $this->domain, + $this->locale, + $this->translation, + $meta + ); + } /** * @return int