@@ -117,7 +117,7 @@ |
||
| 117 | 117 | public function getId() |
| 118 | 118 | { |
| 119 | 119 | if (!$this->id) { |
| 120 | - $this->setId(sha1($this->getDomain() . $this->getKey())); |
|
| 120 | + $this->setId(sha1($this->getDomain().$this->getKey())); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | return $this->id; |
@@ -205,7 +205,7 @@ |
||
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | /** |
| 208 | - * @param Message[]|Collection $messages |
|
| 208 | + * @param Collection $messages |
|
| 209 | 209 | */ |
| 210 | 210 | public function setMessages(Collection $messages = null) |
| 211 | 211 | { |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | $configuration = new Configuration(); |
| 33 | 33 | $config = $this->processConfiguration($configuration, $configs); |
| 34 | 34 | |
| 35 | - $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); |
|
| 35 | + $loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
|
| 36 | 36 | $loader->load('services.yml'); |
| 37 | 37 | $loader->load('filters_container.yml'); |
| 38 | 38 | |
@@ -74,7 +74,7 @@ |
||
| 74 | 74 | { |
| 75 | 75 | $cwd = getcwd(); |
| 76 | 76 | if (substr($cwd, -3) === 'web') { |
| 77 | - chdir($cwd . DIRECTORY_SEPARATOR . '..'); |
|
| 77 | + chdir($cwd.DIRECTORY_SEPARATOR.'..'); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | $output = ['error' => false]; |
@@ -133,7 +133,7 @@ |
||
| 133 | 133 | * |
| 134 | 134 | * @param string $domain |
| 135 | 135 | * @param string $path |
| 136 | - * @param array $directories |
|
| 136 | + * @param string[] $directories |
|
| 137 | 137 | * |
| 138 | 138 | * @return array |
| 139 | 139 | */ |
@@ -155,8 +155,8 @@ discard block |
||
| 155 | 155 | { |
| 156 | 156 | if (!$directories) { |
| 157 | 157 | $directories = [ |
| 158 | - $path . 'Resources' . DIRECTORY_SEPARATOR . 'translations', |
|
| 159 | - $this->kernelRoot . DIRECTORY_SEPARATOR . 'Resources' . DIRECTORY_SEPARATOR . $domain . DIRECTORY_SEPARATOR . 'translations', |
|
| 158 | + $path.'Resources'.DIRECTORY_SEPARATOR.'translations', |
|
| 159 | + $this->kernelRoot.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.$domain.DIRECTORY_SEPARATOR.'translations', |
|
| 160 | 160 | ]; |
| 161 | 161 | } |
| 162 | 162 | |
@@ -221,12 +221,12 @@ discard block |
||
| 221 | 221 | */ |
| 222 | 222 | private function flatten($array, $prefix = '') { |
| 223 | 223 | $result = []; |
| 224 | - foreach($array as $key=>$value) { |
|
| 225 | - if(is_array($value)) { |
|
| 226 | - $result = $result + $this->flatten($value, $prefix . $key . '.'); |
|
| 224 | + foreach ($array as $key=>$value) { |
|
| 225 | + if (is_array($value)) { |
|
| 226 | + $result = $result + $this->flatten($value, $prefix.$key.'.'); |
|
| 227 | 227 | } |
| 228 | 228 | else { |
| 229 | - $result[$prefix . $key] = $value; |
|
| 229 | + $result[$prefix.$key] = $value; |
|
| 230 | 230 | } |
| 231 | 231 | } |
| 232 | 232 | return $result; |
@@ -224,8 +224,7 @@ |
||
| 224 | 224 | foreach($array as $key=>$value) { |
| 225 | 225 | if(is_array($value)) { |
| 226 | 226 | $result = $result + $this->flatten($value, $prefix . $key . '.'); |
| 227 | - } |
|
| 228 | - else { |
|
| 227 | + } else { |
|
| 229 | 228 | $result[$prefix . $key] = $value; |
| 230 | 229 | } |
| 231 | 230 | } |
@@ -48,7 +48,6 @@ |
||
| 48 | 48 | private $parser; |
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | - * @param ParameterBag $loadersContainer |
|
| 52 | 51 | * @param TranslationManager $translationManager |
| 53 | 52 | * @param YmlExport $exporter |
| 54 | 53 | */ |
@@ -112,12 +112,12 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | private function flatten($array, $prefix = '') { |
| 114 | 114 | $result = []; |
| 115 | - foreach($array as $key=>$value) { |
|
| 116 | - if(is_array($value)) { |
|
| 117 | - $result = $result + $this->flatten($value, $prefix . $key . '.'); |
|
| 115 | + foreach ($array as $key=>$value) { |
|
| 116 | + if (is_array($value)) { |
|
| 117 | + $result = $result + $this->flatten($value, $prefix.$key.'.'); |
|
| 118 | 118 | } |
| 119 | 119 | else { |
| 120 | - $result[$prefix . $key] = $value; |
|
| 120 | + $result[$prefix.$key] = $value; |
|
| 121 | 121 | } |
| 122 | 122 | } |
| 123 | 123 | return $result; |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | foreach ($messages as $key => $message) { |
| 149 | 149 | if ($message->getStatus() === Message::DIRTY || $force) { |
| 150 | 150 | $path = sprintf( |
| 151 | - '%s' . DIRECTORY_SEPARATOR . '%s.%s.%s', |
|
| 151 | + '%s'.DIRECTORY_SEPARATOR.'%s.%s.%s', |
|
| 152 | 152 | $translation->getPath(), |
| 153 | 153 | 'messages', |
| 154 | 154 | $message->getLocale(), |
@@ -224,8 +224,7 @@ |
||
| 224 | 224 | foreach($array as $key=>$value) { |
| 225 | 225 | if(is_array($value)) { |
| 226 | 226 | $result = $result + $this->flatten($value, $prefix . $key . '.'); |
| 227 | - } |
|
| 228 | - else { |
|
| 227 | + } else { |
|
| 229 | 228 | $result[$prefix . $key] = $value; |
| 230 | 229 | } |
| 231 | 230 | } |
@@ -74,7 +74,7 @@ |
||
| 74 | 74 | $export->export($this->getContainer()->getParameter('ongr_translations.bundles'), $input->getOption('force')); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - $prettify = function ($array) { |
|
| 77 | + $prettify = function($array) { |
|
| 78 | 78 | return !empty($array) ? implode('</comment><info>`, `</info><comment>', $array) : 'all'; |
| 79 | 79 | }; |
| 80 | 80 | |
@@ -18,8 +18,6 @@ |
||
| 18 | 18 | use ONGR\ElasticsearchBundle\Service\Repository; |
| 19 | 19 | use ONGR\TranslationsBundle\Document\Message; |
| 20 | 20 | use ONGR\TranslationsBundle\Document\Translation; |
| 21 | -use ONGR\TranslationsBundle\Event\Events; |
|
| 22 | -use ONGR\TranslationsBundle\Event\MessageUpdateEvent; |
|
| 23 | 21 | use Symfony\Component\EventDispatcher\EventDispatcherInterface; |
| 24 | 22 | use Symfony\Component\HttpFoundation\Request; |
| 25 | 23 | |
@@ -75,7 +75,7 @@ |
||
| 75 | 75 | $translations = $import->getTranslationsFromFiles( |
| 76 | 76 | $domain, |
| 77 | 77 | null, |
| 78 | - [$this->getContainer()->getParameter('kernel.root_dir') . DIRECTORY_SEPARATOR . 'Resources' . DIRECTORY_SEPARATOR . 'translations'] |
|
| 78 | + [$this->getContainer()->getParameter('kernel.root_dir').DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'translations'] |
|
| 79 | 79 | ); |
| 80 | 80 | |
| 81 | 81 | $import->writeToStorage($domain, $translations); |