Translator   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 5
Bugs 0 Features 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 22
rs 10
c 5
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A get() 0 9 2
1
<?php namespace Modules\Translation\Services;
2
3
use Illuminate\Foundation\Bus\DispatchesJobs;
4
use Modules\Translation\Repositories\TranslationRepository;
5
6
class Translator extends \Illuminate\Translation\Translator
7
{
8
    use DispatchesJobs;
9
    /**
10
     * Get the translation for the given key.
11
     *
12
     * @param  string  $key
13
     * @param  array   $replace
14
     * @param  string  $locale
15
     * @param  bool  $fallback
16
     * @return string
17
     */
18
    public function get($key, array $replace = [], $locale = null, $fallback = true)
19
    {
20
        $translationRepository = app(TranslationRepository::class);
21
        if ($translation = $translationRepository->findByKeyAndLocale($key, $locale)) {
22
            return $this->makeReplacements($translation, $replace);
23
        }
24
25
        return parent::get($key, $replace, $locale);
26
    }
27
}
28