File tree Expand file tree Collapse file tree 6 files changed +51
-13
lines changed
Expand file tree Collapse file tree 6 files changed +51
-13
lines changed Original file line number Diff line number Diff line change @@ -17,23 +17,19 @@ class Loader
1717 */
1818 public static function load (string $ path )
1919 {
20- if (file_exists ($ path . ' /vendor/autoload.php ' ) && file_exists ( $ path . ' /bootstrap/app.php ' )) {
20+ if (LaravelLoader:: supports ($ path )) {
2121 return new LaravelLoader ($ path );
2222 }
2323
24- if (file_exists ($ path . ' /vendor/autoload.php ' ) && file_exists ( $ path . ' /symfony.lock ' ) && file_exists ( $ path . ' /src/Kernel.php ' )) {
24+ if (SymfonyLoader:: supports ($ path )) {
2525 return new SymfonyLoader ($ path );
2626 }
2727
28- if (file_exists ($ path . ' /wp-load.php ' )) {
28+ if (WordPressLoader:: supports ($ path )) {
2929 return new WordPressLoader ($ path );
3030 }
3131
32- if (file_exists ($ path . '/vendor/autoload.php ' ) && file_exists ($ path . '/vendor/pimcore/pimcore ' )) {
33- return new PimcoreLoader ($ path );
34- }
35-
36- if (file_exists ($ path . '/vendor/autoload.php ' )) {
32+ if (ComposerLoader::supports ($ path )) {
3733 return new ComposerLoader ($ path );
3834 }
3935
Original file line number Diff line number Diff line change 44
55class ComposerLoader extends BaseLoader
66{
7+ /**
8+ * @param string $path
9+ * @return bool
10+ */
11+ public static function supports (string $ path ): bool
12+ {
13+ return file_exists ($ path . '/vendor/autoload.php ' );
14+ }
15+
716 /**
817 * @param string $path
918 */
@@ -24,4 +33,4 @@ public function version(): string
2433 {
2534 return "" ;
2635 }
27- }
36+ }
Original file line number Diff line number Diff line change @@ -8,6 +8,15 @@ class LaravelLoader extends ComposerLoader
88{
99 private $ app ;
1010
11+ /**
12+ * @param string $path
13+ * @return bool
14+ */
15+ public static function supports (string $ path ): bool
16+ {
17+ return file_exists ($ path . '/vendor/autoload.php ' ) && file_exists ($ path . '/bootstrap/app.php ' );
18+ }
19+
1120 /**
1221 * @param string $path
1322 */
@@ -47,4 +56,4 @@ public function version(): string
4756 {
4857 return $ this ->app ->version ();
4958 }
50- }
59+ }
Original file line number Diff line number Diff line change 44
55interface LoaderInterface
66{
7+ /**
8+ * @param string $path
9+ * @return bool
10+ */
11+ public static function supports (string $ path ): bool ;
12+
713 /**
814 * @return string
915 */
@@ -24,4 +30,4 @@ public function init();
2430 * @return void
2531 */
2632 public function execute (string $ code );
27- }
33+ }
Original file line number Diff line number Diff line change @@ -6,6 +6,15 @@ class SymfonyLoader extends ComposerLoader
66{
77 private $ kernel ;
88
9+ /**
10+ * @param string $path
11+ * @return bool
12+ */
13+ public static function supports (string $ path ): bool
14+ {
15+ return file_exists ($ path . '/vendor/autoload.php ' ) && file_exists ($ path . '/symfony.lock ' ) && file_exists ($ path . '/src/Kernel.php ' );
16+ }
17+
918 /**
1019 * @param string $path
1120 */
@@ -57,4 +66,4 @@ public function version(): string
5766 {
5867 return \Symfony \Component \HttpKernel \Kernel::VERSION ;
5968 }
60- }
69+ }
Original file line number Diff line number Diff line change 66
77class WordPressLoader extends BaseLoader
88{
9+ /**
10+ * @param string $path
11+ * @return bool
12+ */
13+ public static function supports (string $ path ): bool
14+ {
15+ return file_exists ($ path . '/wp-load.php ' );
16+ }
17+
918 /**
1019 * @param string $path
1120 */
@@ -34,4 +43,4 @@ public function version(): string
3443
3544 return "" ;
3645 }
37- }
46+ }
You can’t perform that action at this time.
0 commit comments