@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | * Save a single attribute |
| 45 | 45 | * |
| 46 | 46 | * @param $locale |
| 47 | - * @param $attribute |
|
| 47 | + * @param string $attribute |
|
| 48 | 48 | * @param $value |
| 49 | 49 | */ |
| 50 | 50 | public function saveTranslation($locale, $attribute, $value) |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | - * @param $attribute |
|
| 58 | + * @param string $attribute |
|
| 59 | 59 | * @param null $locale |
| 60 | 60 | * @param bool $fallback | if locale not present, use fallback locale instead |
| 61 | 61 | * @return string null |
@@ -90,7 +90,7 @@ |
||
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
| 93 | - * @param $action |
|
| 93 | + * @param string $action |
|
| 94 | 94 | * @param $locale |
| 95 | 95 | * @param $key |
| 96 | 96 | * @param $new_value |
@@ -175,6 +175,9 @@ |
||
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | |
| 178 | + /** |
|
| 179 | + * @param string $action |
|
| 180 | + */ |
|
| 178 | 181 | private function displayDetails($action) |
| 179 | 182 | { |
| 180 | 183 | $stats = $this->importer->getStats(); |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | protected $defer = true; |
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | - * @return array |
|
| 19 | + * @return string[] |
|
| 20 | 20 | */ |
| 21 | 21 | public function provides() |
| 22 | 22 | { |
@@ -2,12 +2,12 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Thinktomorrow\Squanto; |
| 4 | 4 | |
| 5 | -use League\Flysystem\Filesystem; |
|
| 6 | -use Thinktomorrow\Squanto\Services\CachedTranslationFile; |
|
| 7 | -use Thinktomorrow\Squanto\Import\ImportTranslationsCommand; |
|
| 8 | 5 | use Illuminate\Translation\TranslationServiceProvider as BaseServiceProvider; |
| 9 | 6 | use League\Flysystem\Adapter\Local; |
| 7 | +use League\Flysystem\Filesystem; |
|
| 8 | +use Thinktomorrow\Squanto\Import\ImportTranslationsCommand; |
|
| 10 | 9 | use Thinktomorrow\Squanto\Services\CacheTranslationsCommand; |
| 10 | +use Thinktomorrow\Squanto\Services\CachedTranslationFile; |
|
| 11 | 11 | use Thinktomorrow\Squanto\Services\LaravelTranslationsReader; |
| 12 | 12 | use Thinktomorrow\Squanto\Translators\SquantoTranslator; |
| 13 | 13 | |
@@ -4,8 +4,6 @@ |
||
| 4 | 4 | |
| 5 | 5 | use Exception; |
| 6 | 6 | use Illuminate\Console\Command; |
| 7 | -use Symfony\Component\Console\Helper\Table; |
|
| 8 | -use Symfony\Component\Console\Helper\TableSeparator; |
|
| 9 | 7 | |
| 10 | 8 | class CacheTranslationsCommand extends Command |
| 11 | 9 | { |
@@ -56,10 +56,10 @@ discard block |
||
| 56 | 56 | * Get from excluded sources. This is used here to make retrieval of these |
| 57 | 57 | * non-managed translations a lot faster by going straight to source |
| 58 | 58 | * |
| 59 | - * @param $key |
|
| 59 | + * @param string $key |
|
| 60 | 60 | * @param $replace |
| 61 | - * @param $locale |
|
| 62 | - * @param $fallback |
|
| 61 | + * @param string $locale |
|
| 62 | + * @param boolean $fallback |
|
| 63 | 63 | * @return array|null|string |
| 64 | 64 | */ |
| 65 | 65 | private function getFromExcludedSource($key, $replace, $locale, $fallback) |
@@ -72,9 +72,9 @@ discard block |
||
| 72 | 72 | /** |
| 73 | 73 | * Retrieve the translation from the squanto cache. |
| 74 | 74 | * |
| 75 | - * @param $key |
|
| 75 | + * @param string $key |
|
| 76 | 76 | * @param array $replace |
| 77 | - * @param null $locale |
|
| 77 | + * @param string $locale |
|
| 78 | 78 | * @return mixed|null |
| 79 | 79 | */ |
| 80 | 80 | private function getFromCache($key, array $replace = array(), $locale = null, $fallback = true) |
@@ -88,6 +88,10 @@ discard block |
||
| 88 | 88 | return ($result !== $key) ? $result : null; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | + /** |
|
| 92 | + * @param string $key |
|
| 93 | + * @param string $locale |
|
| 94 | + */ |
|
| 91 | 95 | private function getFromDatabase($key, array $replace = array(), $locale = null, $fallback = true) |
| 92 | 96 | { |
| 93 | 97 | /** |
@@ -4,7 +4,6 @@ |
||
| 4 | 4 | |
| 5 | 5 | use Illuminate\Support\Facades\Schema; |
| 6 | 6 | use Illuminate\Translation\Translator as LaravelTranslator; |
| 7 | -use Thinktomorrow\Squanto\Domain\LineKey; |
|
| 8 | 7 | use Thinktomorrow\Squanto\Domain\PageKey; |
| 9 | 8 | |
| 10 | 9 | class SquantoTranslator extends LaravelTranslator implements Translator |
@@ -2,8 +2,8 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Thinktomorrow\Squanto\Domain; |
| 4 | 4 | |
| 5 | -use Illuminate\Database\Eloquent\Model; |
|
| 6 | 5 | use Dimsav\Translatable\Translatable as BaseTranslatable; |
| 6 | +use Illuminate\Database\Eloquent\Model; |
|
| 7 | 7 | use Illuminate\Support\Collection; |
| 8 | 8 | use Illuminate\Support\Facades\DB; |
| 9 | 9 | |
@@ -21,6 +21,9 @@ |
||
| 21 | 21 | return $page; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | + /** |
|
| 25 | + * @param string $key |
|
| 26 | + */ |
|
| 24 | 27 | public static function findOrCreateByKey($key) |
| 25 | 28 | { |
| 26 | 29 | if ($page = self::findByKey($key)) { |
@@ -41,6 +41,9 @@ |
||
| 41 | 41 | return $this->push($key, $value, true); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | + /** |
|
| 45 | + * @param string $key |
|
| 46 | + */ |
|
| 44 | 47 | private function push($action, $value, $single = false, $key = null) |
| 45 | 48 | { |
| 46 | 49 | if ($single) { |