File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -86,17 +86,27 @@ public static function pathFormat(string $dirName): string
8686 }
8787
8888 /**
89- * @param string $path e.g phar://E:/workenv/xxx/yyy/app.phar/web
89+ * @param string $path
9090 *
9191 * @return string
9292 */
9393 public static function clearPharPath (string $ path ): string
94+ {
95+ return self ::clearPharMark ($ path );
96+ }
97+
98+ /**
99+ * @param string $path e.g 'phar://E:/workenv/xxx/yyy/app.phar/web' -> 'E:/workenv/xxx/yyy/web'
100+ *
101+ * @return string
102+ */
103+ public static function clearPharMark (string $ path ): string
94104 {
95105 if (strpos ($ path , 'phar:// ' ) === 0 ) {
96106 $ path = (string )substr ($ path , 7 );
97107
98108 if (strpos ($ path , '.phar ' ) > 0 ) {
99- return preg_replace ('/\/[\w-]+\.phar/ ' , '' , $ path );
109+ return preg_replace ('/\/[\w\. -]+\.phar/ ' , '' , $ path );
100110 }
101111 }
102112
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ public function testClearPharPath(): void
3333 ['phar:///workenv/xxx/yyy/app.phar/web ' , '/workenv/xxx/yyy/web ' ],
3434 ['E:/workenv/xxx/yyy/web ' , 'E:/workenv/xxx/yyy/web ' ],
3535 ['/workenv/xxx/yyy/web ' , '/workenv/xxx/yyy/web ' ],
36+ ['phar:///home/runner/kite/kite-v1.1.8.phar/config/config.php ' , '/home/runner/kite/config/config.php ' ],
3637 ];
3738
3839 foreach ($ tests as [$ test , $ want ]) {
You can’t perform that action at this time.
0 commit comments