1 | <?php |
||
8 | class SquantoTranslator extends LaravelTranslator implements Translator |
||
9 | { |
||
10 | private $databaseTranslator; |
||
11 | |||
12 | private $keyAsDefault = true; |
||
13 | 69 | private $isDatabaseAlreadyMigrated = null; |
|
14 | |||
15 | 69 | public function setKeyAsDefault($keyAsDefault = true) |
|
19 | |||
20 | /** |
||
21 | * Get the translation for the given key by following this priority chain: |
||
22 | * |
||
23 | * 1. Get from our cached translations |
||
24 | * 2. Get from database |
||
25 | * 3. Get from the /resources/lang |
||
26 | * |
||
27 | * @param string $key |
||
28 | * @param array $replace |
||
29 | * @param string $locale |
||
30 | * @param bool $fallback |
||
31 | 21 | * @return string |
|
32 | */ |
||
33 | 21 | public function get($key, array $replace = array(), $locale = null, $fallback = true) |
|
49 | |||
50 | /** |
||
51 | * Retrieve the translation from the squanto cache. |
||
52 | * |
||
53 | * @param $key |
||
54 | * @param array $replace |
||
55 | * @param null $locale |
||
56 | 21 | * @return mixed|null |
|
57 | */ |
||
58 | 21 | private function getFromCache($key, array $replace = array(), $locale = null, $fallback = true) |
|
68 | |||
69 | 12 | private function getFromDatabase($key, array $replace = array(), $locale = null, $fallback = true) |
|
82 | |||
83 | /** |
||
84 | * Verify that SQUANTO migrations are already run and present in this environment |
||
85 | * Allow for a soft install |
||
86 | * |
||
87 | * @return null |
||
88 | */ |
||
89 | private function isDatabaseAlreadyMigrated() |
||
95 | } |
||
96 |
This check looks for a call to a parent method whose name is different than the method from which it is called.
Consider the following code:
The
getFirstName()
method in theSon
calls the wrong method in the parent class.