2
2
3
3
namespace Illuminate \Foundation \Console ;
4
4
5
- use ClassPreloader \Factory ;
6
5
use Illuminate \Console \Command ;
7
6
use Illuminate \Support \Composer ;
8
7
use Symfony \Component \Console \Input \InputOption ;
9
- use ClassPreloader \Exceptions \VisitorExceptionInterface ;
10
8
11
9
class OptimizeCommand extends Command
12
10
{
@@ -59,54 +57,7 @@ public function fire()
59
57
$ this ->composer ->dumpOptimized ();
60
58
}
61
59
62
- if ($ this ->option ('force ' ) || ! $ this ->laravel ['config ' ]['app.debug ' ]) {
63
- $ this ->info ('Compiling common classes ' );
64
- $ this ->compileClasses ();
65
- } else {
66
- $ this ->call ('clear-compiled ' );
67
- }
68
- }
69
-
70
- /**
71
- * Generate the compiled class file.
72
- *
73
- * @return void
74
- */
75
- protected function compileClasses ()
76
- {
77
- $ preloader = (new Factory )->create (['skip ' => true ]);
78
-
79
- $ handle = $ preloader ->prepareOutput ($ this ->laravel ->getCachedCompilePath ());
80
-
81
- foreach ($ this ->getClassFiles () as $ file ) {
82
- try {
83
- fwrite ($ handle , $ preloader ->getCode ($ file , false )."\n" );
84
- } catch (VisitorExceptionInterface $ e ) {
85
- //
86
- }
87
- }
88
-
89
- fclose ($ handle );
90
- }
91
-
92
- /**
93
- * Get the classes that should be combined and compiled.
94
- *
95
- * @return array
96
- */
97
- protected function getClassFiles ()
98
- {
99
- $ app = $ this ->laravel ;
100
-
101
- $ core = require __DIR__ .'/Optimize/config.php ' ;
102
-
103
- $ files = array_merge ($ core , $ app ['config ' ]->get ('compile.files ' , []));
104
-
105
- foreach ($ app ['config ' ]->get ('compile.providers ' , []) as $ provider ) {
106
- $ files = array_merge ($ files , forward_static_call ([$ provider , 'compiles ' ]));
107
- }
108
-
109
- return array_map ('realpath ' , $ files );
60
+ $ this ->call ('clear-compiled ' );
110
61
}
111
62
112
63
/**
@@ -117,8 +68,6 @@ protected function getClassFiles()
117
68
protected function getOptions ()
118
69
{
119
70
return [
120
- ['force ' , null , InputOption::VALUE_NONE , 'Force the compiled class file to be written. ' ],
121
-
122
71
['psr ' , null , InputOption::VALUE_NONE , 'Do not optimize Composer dump-autoload. ' ],
123
72
];
124
73
}
0 commit comments