1 | <?php |
||
14 | class SquantoServiceProvider extends BaseServiceProvider |
||
15 | { |
||
16 | protected $defer = true; |
||
17 | |||
18 | /** |
||
19 | * @return array |
||
20 | */ |
||
21 | 1 | public function provides() |
|
31 | |||
32 | /** |
||
33 | * Bootstrap any application services. |
||
34 | * |
||
35 | * @return void |
||
36 | */ |
||
37 | 87 | public function boot() |
|
38 | { |
||
39 | 87 | $this->loadTranslationsFrom($this->getSquantoCachePath(), 'squanto'); |
|
40 | // $this->app['translator']->addNamespace('squanto', $this->getSquantoCachePath()); |
||
|
|||
41 | 46 | ||
42 | 87 | if ($this->app->runningInConsole()) { |
|
43 | 87 | $this->publishes([ |
|
44 | 87 | __DIR__.'/../config/squanto.php' => config_path('squanto.php') |
|
45 | 41 | ], 'config'); |
|
46 | 46 | ||
47 | 87 | if (!class_exists('CreateSquantoTables')) { |
|
48 | 47 | $this->publishes([ |
|
49 | 1 | __DIR__.'/../database/migrations/create_squanto_tables.php' => database_path('migrations/'.date('Y_m_d_His', time()).'_create_squanto_tables.php'), |
|
50 | 47 | ], 'migrations'); |
|
51 | } |
||
52 | |||
53 | 41 | $this->commands([ |
|
54 | 41 | ImportTranslationsCommand::class, |
|
55 | CacheTranslationsCommand::class, |
||
56 | ]); |
||
57 | 46 | } |
|
58 | 41 | } |
|
59 | 46 | ||
60 | 46 | /** |
|
61 | * Register our translator |
||
62 | 46 | * |
|
63 | * @return void |
||
64 | */ |
||
65 | 43 | public function register() |
|
66 | 2 | { |
|
67 | 41 | $this->app['squanto.cache_path'] = $this->getSquantoCachePath(); |
|
68 | 87 | $this->app['squanto.lang_path'] = $this->getSquantoLangPath(); |
|
69 | |||
70 | 41 | $this->registerTranslator(); |
|
71 | |||
72 | $this->app->bind(CachedTranslationFile::class, function ($app) { |
||
73 | return new CachedTranslationFile( |
||
74 | 46 | new Filesystem(new Local($this->getSquantoCachePath())) |
|
75 | ); |
||
76 | 41 | }); |
|
77 | 18 | ||
78 | 18 | $this->app->bind(LaravelTranslationsReader::class, function ($app) { |
|
79 | 5 | return new LaravelTranslationsReader( |
|
80 | 51 | new Filesystem(new Local($this->getSquantoLangPath())) |
|
81 | ); |
||
82 | 87 | }); |
|
83 | 46 | ||
84 | 41 | $this->mergeConfigFrom(__DIR__.'/../config/squanto.php', 'squanto'); |
|
85 | 41 | } |
|
86 | 46 | ||
87 | 87 | private function registerTranslator() |
|
106 | 46 | ||
107 | 87 | private function getSquantoCachePath() |
|
112 | 46 | ||
113 | 41 | private function getSquantoLangPath() |
|
118 | } |
||
119 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.