Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "JVM emulator by PHP",
"type": "library",
"license": "MIT",
"version": "0.0.7.0-dev",
"version": "0.0.7.1-dev",
"authors": [
{
"name": "memory"
Expand Down
7 changes: 6 additions & 1 deletion src/Core/JVM/AttributePool.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use PHPJava\Kernel\Attributes\AttributeInfo;
use PHPJava\Utilities\DebugTool;

class AttributePool implements \ArrayAccess, \Countable
class AttributePool implements \ArrayAccess, \Countable, \IteratorAggregate
{
private $entries = [];
private $reader;
Expand Down Expand Up @@ -58,4 +58,9 @@ public function offsetUnset($offset)
{
throw new ReadOnlyException('You cannot rewrite datum. The Attribute Pool is read-only.');
}

public function getIterator()
{
return new \ArrayIterator($this->entries);
}
}
7 changes: 6 additions & 1 deletion src/Core/JVM/ConstantPool.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use PHPJava\Kernel\Structures\_Utf8;
use PHPJava\Kernel\Structures\StructureInterface;

class ConstantPool implements \ArrayAccess, \Countable
class ConstantPool implements \ArrayAccess, \Countable, \IteratorAggregate
{
private $entries = [];
private $reader;
Expand Down Expand Up @@ -116,4 +116,9 @@ public function offsetUnset($offset)
{
throw new ReadOnlyException('You cannot rewrite datum. The Constant Pool is read-only.');
}

public function getIterator()
{
return new \ArrayIterator($this->entries);
}
}
7 changes: 6 additions & 1 deletion src/Core/JVM/FieldPool.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use PHPJava\Kernel\Structures\_FieldInfo;
use PHPJava\Utilities\DebugTool;

class FieldPool implements \ArrayAccess, \Countable
class FieldPool implements \ArrayAccess, \Countable, \IteratorAggregate
{
private $entries = [];
private $reader;
Expand Down Expand Up @@ -56,4 +56,9 @@ public function offsetUnset($offset)
{
throw new ReadOnlyException('You cannot rewrite datum. The Field Pool is read-only.');
}

public function getIterator()
{
return new \ArrayIterator($this->entries);
}
}
7 changes: 6 additions & 1 deletion src/Core/JVM/InterfacePool.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use PHPJava\Exceptions\ReadOnlyException;
use PHPJava\Utilities\DebugTool;

class InterfacePool implements \ArrayAccess, \Countable
class InterfacePool implements \ArrayAccess, \Countable, \IteratorAggregate
{
private $entries = [];
private $reader;
Expand Down Expand Up @@ -52,4 +52,9 @@ public function offsetUnset($offset)
{
throw new ReadOnlyException('You cannot rewrite datum. The Interface Pool is read-only.');
}

public function getIterator()
{
return new \ArrayIterator($this->entries);
}
}
7 changes: 6 additions & 1 deletion src/Core/JVM/MethodPool.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use PHPJava\Kernel\Structures\_MethodInfo;
use PHPJava\Utilities\DebugTool;

class MethodPool implements \ArrayAccess, \Countable
class MethodPool implements \ArrayAccess, \Countable, \IteratorAggregate
{
private $entries = [];
private $reader;
Expand Down Expand Up @@ -55,4 +55,9 @@ public function offsetUnset($offset)
{
throw new ReadOnlyException('You cannot rewrite datum. The Interface Pool is read-only.');
}

public function getIterator()
{
return new \ArrayIterator($this->entries);
}
}
16 changes: 14 additions & 2 deletions src/Core/JavaClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use PHPJava\Exceptions\ValidatorException;
use PHPJava\Kernel\Attributes\AttributeInterface;
use PHPJava\Kernel\Attributes\InnerClassesAttribute;
use PHPJava\Kernel\Attributes\SourceFileAttribute;
use PHPJava\Kernel\Maps\FieldAccessFlag;
use PHPJava\Kernel\Structures\_Utf8;
use PHPJava\Utilities\ClassResolver;
Expand Down Expand Up @@ -248,11 +249,22 @@ public function __destruct()

public function getClassName(bool $shortName = false): string
{
$className = $this->className->getString();
if ($shortName === true) {
$split = explode('$', $this->className->getString());
$split = explode('$', $className);
return $split[count($split) - 1];
}
return $this->className->getString();
return $className;
}


public function getPackageName(): ?string
{
$className = dirname($this->className->getString());
if ($className === '') {
return null;
}
return str_replace('/', '.', $className);
}

public function getInnerClasses(): array
Expand Down
2 changes: 1 addition & 1 deletion src/Core/PHPJava.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ final class PHPJava
/**
* As same as composer version.
*/
const VERSION = 0x000070;
const VERSION = 0x000071;
}