Skip to content

Commit 8b95075

Browse files
committed
Add entrypoint finder
1 parent a4270e0 commit 8b95075

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/Core/JavaArchive.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
class JavaArchive
99
{
1010
const MANIFEST_FILE_NAME = 'META-INF/MANIFEST.MF';
11+
const DEFAULT_ENTRYPOINT_NAME = 'main';
1112

1213
private $manifestData = [];
1314
private $jarFile;
@@ -113,4 +114,19 @@ public function getClassByName(string $name): JavaClass
113114
}
114115
return $this->classes[$name];
115116
}
117+
118+
private function getEntryPointFinderPath(): array
119+
{
120+
if (strpos('.', $this->getEntryPointName()) === false) {
121+
return [
122+
[$this->getEntryPointName(), static::DEFAULT_ENTRYPOINT_NAME],
123+
];
124+
}
125+
$splitEntryPoint = explode('.', $this->getEntryPointName());
126+
$methodOrClassName = array_pop($splitEntryPoint);
127+
return [
128+
[implode('.', $splitEntryPoint), $methodOrClassName],
129+
[$this->getEntryPointName(), static::DEFAULT_ENTRYPOINT_NAME],
130+
];
131+
}
116132
}

0 commit comments

Comments
 (0)