| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace Victormln\LaravelTactician\Providers; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | use Illuminate\Support\ServiceProvider; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | use Victormln\LaravelTactician\Commands\MakeTacticianCommand; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | use Victormln\LaravelTactician\Commands\MakeTacticianCommandCommand; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | use Victormln\LaravelTactician\Commands\MakeTacticianHandlerCommand; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  * Class LaravelTacticianServiceProvider | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |  * @package Victormln\LaravelTactician\Providers | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 14 |  |  |  */ | 
            
                                                                        
                            
            
                                    
            
            
                | 15 |  |  | class LaravelTacticianServiceProvider extends ServiceProvider | 
            
                                                                        
                            
            
                                    
            
            
                | 16 |  |  | { | 
            
                                                                        
                            
            
                                    
            
            
                | 17 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 18 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 19 |  |  |      * Do the bindings so any implementation can be swapped | 
            
                                                                        
                            
            
                                    
            
            
                | 20 |  |  |      * | 
            
                                                                        
                            
            
                                    
            
            
                | 21 |  |  |      * @return void | 
            
                                                                        
                            
            
                                    
            
            
                | 22 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 23 | 26 |  |     public function register() | 
            
                                                                        
                            
            
                                    
            
            
                | 24 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 25 | 26 |  |         $this->registerConfig(); | 
            
                                                                        
                            
            
                                    
            
            
                | 26 | 26 |  |         $this->app->bind('Victormln\LaravelTactician\Locator\LocatorInterface', config('laravel-tactician.locator')); | 
            
                                                                        
                            
            
                                    
            
            
                | 27 | 26 |  |         $this->app->bind('League\Tactician\Handler\MethodNameInflector\MethodNameInflector', config('laravel-tactician.inflector')); | 
            
                                                                        
                            
            
                                    
            
            
                | 28 | 26 |  |         $this->app->bind('League\Tactician\Handler\CommandNameExtractor\CommandNameExtractor', config('laravel-tactician.extractor')); | 
            
                                                                        
                            
            
                                    
            
            
                | 29 | 26 |  |         $this->app->bind('Victormln\LaravelTactician\CommandBusInterface', config('laravel-tactician.bus')); | 
            
                                                                        
                            
            
                                    
            
            
                | 30 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 31 |  |  |         // Register Command Generator | 
            
                                                                        
                            
            
                                    
            
            
                | 32 | 26 |  |         $this->app->singleton( | 
            
                                                                        
                            
            
                                    
            
            
                | 33 |  |  |             'laravel-tactician.make.command', function ($app) { | 
            
                                                                        
                            
            
                                    
            
            
                | 34 | 8 |  |                 return new MakeTacticianCommandCommand($app['files']); | 
            
                                                                        
                            
            
                                    
            
            
                | 35 | 26 |  |             } | 
            
                                                                        
                            
            
                                    
            
            
                | 36 |  |  |         ); | 
            
                                                                        
                            
            
                                    
            
            
                | 37 | 26 |  |         $this->commands('laravel-tactician.make.command'); | 
            
                                                                        
                            
            
                                    
            
            
                | 38 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 39 |  |  |         // Register Handler Generator | 
            
                                                                        
                            
            
                                    
            
            
                | 40 | 26 |  |         $this->app->singleton( | 
            
                                                                        
                            
            
                                    
            
            
                | 41 |  |  |             'laravel-tactician.make.handler', function ($app) { | 
            
                                                                        
                            
            
                                    
            
            
                | 42 | 8 |  |                 return new MakeTacticianHandlerCommand($app['files']); | 
            
                                                                        
                            
            
                                    
            
            
                | 43 | 26 |  |             } | 
            
                                                                        
                            
            
                                    
            
            
                | 44 |  |  |         ); | 
            
                                                                        
                            
            
                                    
            
            
                | 45 | 26 |  |         $this->commands('laravel-tactician.make.handler'); | 
            
                                                                        
                            
            
                                    
            
            
                | 46 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 47 |  |  |         // Register Comman+Handler Generator Command | 
            
                                                                        
                            
            
                                    
            
            
                | 48 | 26 |  |         $this->app->singleton( | 
            
                                                                        
                            
            
                                    
            
            
                | 49 |  |  |             'laravel-tactician.make.tactician', function () { | 
            
                                                                        
                            
            
                                    
            
            
                | 50 | 8 |  |                 return new MakeTacticianCommand(); | 
            
                                                                        
                            
            
                                    
            
            
                | 51 | 26 |  |             } | 
            
                                                                        
                            
            
                                    
            
            
                | 52 |  |  |         ); | 
            
                                                                        
                            
            
                                    
            
            
                | 53 | 26 |  |         $this->commands('laravel-tactician.make.tactician'); | 
            
                                                                        
                            
            
                                    
            
            
                | 54 | 26 |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 55 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 56 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 57 |  |  |      * Register config. | 
            
                                                                        
                            
            
                                    
            
            
                | 58 |  |  |      * | 
            
                                                                        
                            
            
                                    
            
            
                | 59 |  |  |      * @return void | 
            
                                                                        
                            
            
                                    
            
            
                | 60 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 | 26 |  |     protected function registerConfig() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 | 26 |  |         $this->publishes( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |             [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 | 26 |  |             __DIR__.'/../../config/config.php' => config_path('laravel-tactician.php'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |             ] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 | 26 |  |         $this->mergeConfigFrom( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 | 26 |  |             __DIR__.'/../../config/config.php', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 | 26 |  |             'laravel-tactician' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |         ); | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 72 | 26 |  |     } | 
            
                                                                        
                                                                
            
                                    
            
            
                | 73 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 74 |  |  |  |