@@ -15,16 +15,16 @@ class FractalServiceProvider extends ServiceProvider
1515 *
1616 * @var bool
1717 */
18- protected $ defer = false ;
18+ protected bool $ defer = false ;
1919
2020 /**
2121 * Bootstrap the application events.
2222 *
2323 * @return void
2424 */
25- public function boot ()
25+ public function boot (): void
2626 {
27- $ this ->mergeConfigFrom (__DIR__ . '/../config/datatables-fractal.php ' , 'datatables-fractal ' );
27+ $ this ->mergeConfigFrom (__DIR__ . '/../config/datatables-fractal.php ' , 'datatables-fractal ' );
2828 $ this ->publishAssets ();
2929
3030 $ this ->registerMacro ();
@@ -35,11 +35,11 @@ public function boot()
3535 *
3636 * @return void
3737 */
38- protected function publishAssets ()
38+ protected function publishAssets (): void
3939 {
4040 $ this ->publishes (
4141 [
42- __DIR__ . '/../config/datatables-fractal.php ' => config_path ('datatables-fractal.php ' ),
42+ __DIR__ . '/../config/datatables-fractal.php ' => config_path ('datatables-fractal.php ' ),
4343 ], 'datatables-fractal '
4444 );
4545 }
@@ -49,77 +49,65 @@ protected function publishAssets()
4949 *
5050 * @return void
5151 */
52- protected function registerMacro ()
52+ protected function registerMacro (): void
5353 {
54- DataTableAbstract::macro (
55- 'setTransformer ' , function ($ transformer ) {
56- $ this ->transformer = [$ transformer ];
54+ DataTableAbstract::macro ('setTransformer ' , function ($ transformer ) {
55+ $ this ->transformer = [$ transformer ];
5756
58- return $ this ;
59- }
60- );
57+ return $ this ;
58+ });
6159
62- DataTableAbstract::macro (
63- 'addTransformer ' , function ($ transformer ) {
64- $ this ->transformer [] = $ transformer ;
60+ DataTableAbstract::macro ('addTransformer ' , function ($ transformer ) {
61+ $ this ->transformer [] = $ transformer ;
6562
66- return $ this ;
67- }
68- );
63+ return $ this ;
64+ });
6965
70- DataTableAbstract::macro (
71- 'setSerializer ' , function ($ serializer ) {
72- $ this ->serializer = $ serializer ;
66+ DataTableAbstract::macro ('setSerializer ' , function ($ serializer ) {
67+ $ this ->serializer = $ serializer ;
7368
74- return $ this ;
75- }
76- );
69+ return $ this ;
70+ });
7771 }
7872
7973 /**
8074 * Register the service provider.
8175 *
8276 * @return void
8377 */
84- public function register ()
78+ public function register (): void
8579 {
86- $ this ->app ->singleton (
87- 'datatables.fractal ' , function () {
88- $ fractal = new Manager ;
89- $ config = $ this ->app ['config ' ];
90- $ request = $ this ->app ['request ' ];
91-
92- $ includesKey = $ config ->get ('datatables-fractal.includes ' , 'include ' );
93- if ($ request ->get ($ includesKey )) {
94- $ fractal ->parseIncludes ($ request ->get ($ includesKey ));
95- }
80+ $ this ->app ->singleton ('datatables.fractal ' , function () {
81+ $ fractal = new Manager ;
82+ $ config = $ this ->app ['config ' ];
83+ $ request = $ this ->app ['request ' ];
84+
85+ $ includesKey = $ config ->get ('datatables-fractal.includes ' , 'include ' );
86+ if ($ request ->get ($ includesKey )) {
87+ $ fractal ->parseIncludes ($ request ->get ($ includesKey ));
88+ }
9689
97- $ serializer = $ config ->get ('datatables-fractal.serializer ' , DataArraySerializer::class);
98- $ fractal ->setSerializer (new $ serializer );
90+ $ serializer = $ config ->get ('datatables-fractal.serializer ' , DataArraySerializer::class);
91+ $ fractal ->setSerializer (new $ serializer );
9992
100- return $ fractal ;
101- }
102- );
93+ return $ fractal ;
94+ });
10395
104- $ this ->app ->singleton (
105- 'datatables.transformer ' , function () {
106- return new FractalTransformer ($ this ->app ->make ('datatables.fractal ' ));
107- }
108- );
96+ $ this ->app ->singleton ('datatables.transformer ' , function () {
97+ return new FractalTransformer ($ this ->app ->make ('datatables.fractal ' ));
98+ });
10999
110- $ this ->commands (
111- [
112- TransformerMakeCommand::class,
113- ]
114- );
100+ $ this ->commands ([
101+ TransformerMakeCommand::class,
102+ ]);
115103 }
116104
117105 /**
118106 * Get the services provided by the provider.
119107 *
120108 * @return array
121109 */
122- public function provides ()
110+ public function provides (): array
123111 {
124112 return [
125113 'datatables.fractal ' ,
0 commit comments