@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public function boot() |
28 | 28 | { |
29 | - Blade::directive('translate', function ($expression) { |
|
29 | + Blade::directive('translate', function($expression) { |
|
30 | 30 | |
31 | 31 | $expression = $this->stripParentheses($expression); |
32 | 32 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | } |
36 | 36 | ); |
37 | 37 | |
38 | - Blade::directive('t', function ($expression) { |
|
38 | + Blade::directive('t', function($expression) { |
|
39 | 39 | |
40 | 40 | $expression = $this->stripParentheses($expression); |
41 | 41 |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | 'js' => '/\$filter\(\'translate\'\)\(\'(?\'identifier\'.*?)\'\)/' |
80 | 80 | ]; |
81 | 81 | |
82 | - foreach($folders as $folder) { |
|
82 | + foreach ($folders as $folder) { |
|
83 | 83 | $aFiles = array_merge($aFiles, File::allFiles(base_path().'/'.$folder)); |
84 | 84 | } |
85 | 85 | |
@@ -95,13 +95,13 @@ discard block |
||
95 | 95 | |
96 | 96 | $extension = $file->getExtension(); |
97 | 97 | |
98 | - if(in_array($extension, $valid_extensions)) { |
|
98 | + if (in_array($extension, $valid_extensions)) { |
|
99 | 99 | $content = file_get_contents($file); |
100 | 100 | |
101 | 101 | foreach ($regexes as $key => $regex) { |
102 | 102 | preg_match_all($regex, $content, $result, PREG_SET_ORDER); |
103 | 103 | |
104 | - if(!empty($result[0])) { |
|
104 | + if (!empty($result[0])) { |
|
105 | 105 | $this->addMissing($result, $key); |
106 | 106 | } |
107 | 107 | } |
@@ -117,16 +117,16 @@ discard block |
||
117 | 117 | ['Num', 'Translations...'], |
118 | 118 | [ |
119 | 119 | [$this->found_identifier, "Found"], |
120 | - [$this->new_identifier, "New"], |
|
121 | - [$this->dupl_identifier, "Duplicates"], |
|
120 | + [$this->new_identifier, "New"], |
|
121 | + [$this->dupl_identifier, "Duplicates"], |
|
122 | 122 | [$this->found_parameters, "With Parameters"], |
123 | - [$this->found_invalid, "Invalid"], |
|
123 | + [$this->found_invalid, "Invalid"], |
|
124 | 124 | ] |
125 | 125 | ); |
126 | 126 | |
127 | 127 | $this->line(''); |
128 | 128 | |
129 | - $this->info('Finished in: ' . number_format(microtime(true) - $start, 2) . 'sec'); |
|
129 | + $this->info('Finished in: '.number_format(microtime(true) - $start, 2).'sec'); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
@@ -151,14 +151,14 @@ discard block |
||
151 | 151 | $parameter_string = substr($parameter_string, 1, -1); |
152 | 152 | } |
153 | 153 | |
154 | - $parameter_array = explode(",",$parameter_string); |
|
154 | + $parameter_array = explode(",", $parameter_string); |
|
155 | 155 | $parameters = array(); |
156 | 156 | |
157 | - foreach($parameter_array as $parameter) { |
|
158 | - $parameter = explode("=>",$parameter); |
|
157 | + foreach ($parameter_array as $parameter) { |
|
158 | + $parameter = explode("=>", $parameter); |
|
159 | 159 | |
160 | - $key = str_replace([" ", "'"],"", $parameter[0]); |
|
161 | - $value = str_replace([" ", "'"],"", $parameter[1]); |
|
160 | + $key = str_replace([" ", "'"], "", $parameter[0]); |
|
161 | + $value = str_replace([" ", "'"], "", $parameter[1]); |
|
162 | 162 | |
163 | 163 | $parameters[$key] = $value; |
164 | 164 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | $this->found_parameters++; |
167 | 167 | } |
168 | 168 | |
169 | - if(!isset($aTranslations[$identifier])) { |
|
169 | + if (!isset($aTranslations[$identifier])) { |
|
170 | 170 | $aTranslations[$identifier] = TranslatorFacade::hasIdentifier($identifier); |
171 | 171 | |
172 | 172 | if (!$aTranslations[$identifier]) { |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | $this->dupl_identifier++; |
181 | 181 | } |
182 | 182 | |
183 | - } catch(\Exception $e){ |
|
183 | + } catch (\Exception $e) { |
|
184 | 184 | $this->bar->clear(); |
185 | 185 | $this->info($identifier.' '.strlen($identifier)); |
186 | 186 | $this->info($e->getMessage()); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | DB::beginTransaction(); |
29 | 29 | |
30 | 30 | // Create table for storing roles |
31 | - Schema::create('translation_identifiers', function (Blueprint $table) |
|
31 | + Schema::create('translation_identifiers', function(Blueprint $table) |
|
32 | 32 | { |
33 | 33 | $table->increments('id')->unique(); |
34 | 34 | $table->text('identifier'); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | }); |
44 | 44 | |
45 | 45 | // Create table for storing roles |
46 | - Schema::create('translations', function (Blueprint $table) |
|
46 | + Schema::create('translations', function(Blueprint $table) |
|
47 | 47 | { |
48 | 48 | $table->integer('translation_identifier_id')->unsigned(); |
49 | 49 | $table->foreign('translation_identifier_id')->references('id')->on('translation_identifiers')->onDelete('no action')->onUpdate('no action'); |
@@ -81,7 +81,7 @@ |
||
81 | 81 | $translations = $translations->leftJoin('translations', function ($join) |
82 | 82 | { |
83 | 83 | $join->on( 'translation_identifiers.id', '=', 'translations.translation_identifier_id') |
84 | - ->where('locale', $this->locale); |
|
84 | + ->where('locale', $this->locale); |
|
85 | 85 | } |
86 | 86 | )->get(); |
87 | 87 |
@@ -58,9 +58,9 @@ discard block |
||
58 | 58 | public function refreshCache() |
59 | 59 | { |
60 | 60 | $translations = new TranslationIdentifier(); |
61 | - $translations = $translations->leftJoin('translations', function ($join) |
|
61 | + $translations = $translations->leftJoin('translations', function($join) |
|
62 | 62 | { |
63 | - $join->on( 'translation_identifiers.id', '=', 'translations.translation_identifier_id') |
|
63 | + $join->on('translation_identifiers.id', '=', 'translations.translation_identifier_id') |
|
64 | 64 | ->where('locale', $this->locale); |
65 | 65 | } |
66 | 66 | )->get(); |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | */ |
99 | 99 | function getDatabaseID($identifier) |
100 | 100 | { |
101 | - if(isset($this->translations[$identifier])) { |
|
101 | + if (isset($this->translations[$identifier])) { |
|
102 | 102 | return $this->translations[$identifier]->id; |
103 | 103 | } else { |
104 | 104 | throw new NotFoundResourceException("The translation identifier '".$identifier."' could not be found"); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $query = TranslationIdentifier::with('translations'); |
36 | 36 | |
37 | 37 | if ($locale != '') { |
38 | - $query = $query->whereDoesntHave('translations', function ($query) use ($locale) |
|
38 | + $query = $query->whereDoesntHave('translations', function($query) use ($locale) |
|
39 | 39 | { |
40 | 40 | $query->where('translations.locale', 'like', $locale); |
41 | 41 | } |
@@ -43,12 +43,12 @@ discard block |
||
43 | 43 | } |
44 | 44 | |
45 | 45 | if ($search != '') { |
46 | - $query = $query->where(function ($query) use ($search) { |
|
47 | - $query ->where('identifier', 'LIKE', '%'.$search.'%') |
|
46 | + $query = $query->where(function($query) use ($search) { |
|
47 | + $query ->where('identifier', 'LIKE', '%'.$search.'%') |
|
48 | 48 | ->orWhere('parameters', 'LIKE', '%'.$search.'%') |
49 | - ->orWhere('group', 'LIKE', '%'.$search.'%') |
|
50 | - ->orWhere('page_name', 'LIKE', '%'.$search.'%') |
|
51 | - ->orWhere('description','LIKE', '%'.$search.'%'); |
|
49 | + ->orWhere('group', 'LIKE', '%'.$search.'%') |
|
50 | + ->orWhere('page_name', 'LIKE', '%'.$search.'%') |
|
51 | + ->orWhere('description', 'LIKE', '%'.$search.'%'); |
|
52 | 52 | }); |
53 | 53 | } |
54 | 54 | |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | * @param $state string 'enabled|disabled' |
169 | 169 | * @return \Illuminate\Http\RedirectResponse |
170 | 170 | */ |
171 | - public function changeLiveMode ($state) |
|
171 | + public function changeLiveMode($state) |
|
172 | 172 | { |
173 | 173 | if ($state == 'enable') { |
174 | 174 | session(['translation_live_mode' => true]); |
@@ -114,7 +114,7 @@ |
||
114 | 114 | { |
115 | 115 | $trans_identifier = new TranslationIdentifier(); |
116 | 116 | |
117 | - $trans_identifier = $trans_identifier->with('translations')->whereHas('translations', function ($item) use ($locale) |
|
117 | + $trans_identifier = $trans_identifier->with('translations')->whereHas('translations', function($item) use ($locale) |
|
118 | 118 | { |
119 | 119 | return $item->where('locale', $locale); |
120 | 120 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | { |
27 | 27 | $this->mergeConfigFrom(__DIR__.'/../config/translator.php', 'translator'); |
28 | 28 | |
29 | - $this->app->singleton('Translator', function () { |
|
29 | + $this->app->singleton('Translator', function() { |
|
30 | 30 | return new Translator(); |
31 | 31 | } |
32 | 32 | ); |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | public function boot() |
39 | 39 | { |
40 | 40 | $this->publishes([ |
41 | - __DIR__ . '/../config/translator.php' => config_path('translator.php'), |
|
41 | + __DIR__.'/../config/translator.php' => config_path('translator.php'), |
|
42 | 42 | ], |
43 | 43 | 'config' |
44 | 44 | ); |
@@ -49,7 +49,7 @@ |
||
49 | 49 | * @param $locale |
50 | 50 | */ |
51 | 51 | function __construct($locale){ |
52 | - $this->locale = $locale; |
|
52 | + $this->locale = $locale; |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @param $locale |
50 | 50 | */ |
51 | - function __construct($locale){ |
|
51 | + function __construct($locale) { |
|
52 | 52 | $this->locale = $locale; |
53 | 53 | } |
54 | 54 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @return string |
59 | 59 | */ |
60 | - function getLocale(){ |
|
60 | + function getLocale() { |
|
61 | 61 | return $this->locale; |
62 | 62 | } |
63 | 63 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @param string $group |
69 | 69 | * @return string |
70 | 70 | */ |
71 | - function getTranslation($identifier, $group){ |
|
71 | + function getTranslation($identifier, $group) { |
|
72 | 72 | return $identifier; |
73 | 73 | } |
74 | 74 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * |
78 | 78 | * @return bool |
79 | 79 | */ |
80 | - function refreshCache(){ |
|
80 | + function refreshCache() { |
|
81 | 81 | return true; |
82 | 82 | } |
83 | 83 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * @param string $group |
88 | 88 | * @return array |
89 | 89 | */ |
90 | - function getAllTranslations($group){ |
|
90 | + function getAllTranslations($group) { |
|
91 | 91 | return []; |
92 | 92 | } |
93 | 93 |
@@ -61,7 +61,7 @@ |
||
61 | 61 | $locale_dir = TranslatorFacade::getConfigValue('cache_path').$this->locale; |
62 | 62 | |
63 | 63 | try { |
64 | - $trans_identifier = json_decode(file_get_contents($locale_dir.'/'.$group.'.json'), true); |
|
64 | + $trans_identifier = json_decode(file_get_contents($locale_dir.'/'.$group.'.json'), true); |
|
65 | 65 | } catch (\ErrorException $e) { |
66 | 66 | throw new TranslationCacheNotFound("The Translation cache file '".$locale_dir.'/'.$group.'.json'."' could not be found!"); |
67 | 67 | } |
@@ -44,8 +44,7 @@ |
||
44 | 44 | // the same identifier will not be found twice in the cache, which will result in a duplicate key sql error. |
45 | 45 | if (isset($this->translations[$group][$identifier])) { |
46 | 46 | return $this->translations[$group][$identifier]; |
47 | - } |
|
48 | - else { |
|
47 | + } else { |
|
49 | 48 | throw new TranslationNotInCacheException("The translation identifier '".$identifier."' could not be found in Cache"); |
50 | 49 | } |
51 | 50 | } |