Skip to content

Commit 3841d2d

Browse files
committed
Add options into JavaArchive
1 parent 8cba375 commit 3841d2d

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/Core/JavaArchive.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,23 @@ class JavaArchive
1717
private $expandedHArchive;
1818
private $files = [];
1919
private $classes = [];
20+
private $options = [];
2021

2122
/**
2223
* @param string $jarFile
23-
* @param string|null $entryPoint
24+
* @param array $options
2425
* @throws FileNotFoundException
2526
* @throws \PHPJava\Exceptions\ReadEntryException
2627
* @throws \PHPJava\Exceptions\ValidatorException
2728
* @throws \PHPJava\Imitation\java\lang\ClassNotFoundException
2829
*/
29-
public function __construct(string $jarFile, string $entryPoint = null)
30+
public function __construct(string $jarFile, array $options = [])
3031
{
3132
$this->jarFile = $jarFile;
3233
$archive = new \ZipArchive();
3334
$archive->open($jarFile);
3435
$this->expandedHArchive = $archive;
36+
$this->options = $options;
3537

3638
// Add resolving path
3739
ClassResolver::add(
@@ -72,10 +74,13 @@ function ($fileName) {
7274
);
7375

7476
foreach ($this->files as $className => $code) {
75-
$this->classes[str_replace('/', '.', $className)] = new JavaClass(new JavaClassInlineReader(
76-
$className,
77-
$code
78-
));
77+
$this->classes[str_replace('/', '.', $className)] = new JavaClass(
78+
new JavaClassInlineReader(
79+
$className,
80+
$code
81+
),
82+
$this->options
83+
);
7984
}
8085

8186
$currentDirectory = getcwd();

0 commit comments

Comments
 (0)