File tree Expand file tree Collapse file tree 6 files changed +44
-7
lines changed
Expand file tree Collapse file tree 6 files changed +44
-7
lines changed Original file line number Diff line number Diff line change 66use PHPJava \Kernel \Attributes \AttributeInfo ;
77use PHPJava \Utilities \DebugTool ;
88
9- class AttributePool implements \ArrayAccess, \Countable
9+ class AttributePool implements \ArrayAccess, \Countable, \IteratorAggregate
1010{
1111 private $ entries = [];
1212 private $ reader ;
@@ -58,4 +58,9 @@ public function offsetUnset($offset)
5858 {
5959 throw new ReadOnlyException ('You cannot rewrite datum. The Attribute Pool is read-only. ' );
6060 }
61+
62+ public function getIterator ()
63+ {
64+ return new \ArrayIterator ($ this ->entries );
65+ }
6166}
Original file line number Diff line number Diff line change 2020use PHPJava \Kernel \Structures \_Utf8 ;
2121use PHPJava \Kernel \Structures \StructureInterface ;
2222
23- class ConstantPool implements \ArrayAccess, \Countable
23+ class ConstantPool implements \ArrayAccess, \Countable, \IteratorAggregate
2424{
2525 private $ entries = [];
2626 private $ reader ;
@@ -116,4 +116,9 @@ public function offsetUnset($offset)
116116 {
117117 throw new ReadOnlyException ('You cannot rewrite datum. The Constant Pool is read-only. ' );
118118 }
119+
120+ public function getIterator ()
121+ {
122+ return new \ArrayIterator ($ this ->entries );
123+ }
119124}
Original file line number Diff line number Diff line change 77use PHPJava \Kernel \Structures \_FieldInfo ;
88use PHPJava \Utilities \DebugTool ;
99
10- class FieldPool implements \ArrayAccess, \Countable
10+ class FieldPool implements \ArrayAccess, \Countable, \IteratorAggregate
1111{
1212 private $ entries = [];
1313 private $ reader ;
@@ -56,4 +56,9 @@ public function offsetUnset($offset)
5656 {
5757 throw new ReadOnlyException ('You cannot rewrite datum. The Field Pool is read-only. ' );
5858 }
59+
60+ public function getIterator ()
61+ {
62+ return new \ArrayIterator ($ this ->entries );
63+ }
5964}
Original file line number Diff line number Diff line change 66use PHPJava \Exceptions \ReadOnlyException ;
77use PHPJava \Utilities \DebugTool ;
88
9- class InterfacePool implements \ArrayAccess, \Countable
9+ class InterfacePool implements \ArrayAccess, \Countable, \IteratorAggregate
1010{
1111 private $ entries = [];
1212 private $ reader ;
@@ -52,4 +52,9 @@ public function offsetUnset($offset)
5252 {
5353 throw new ReadOnlyException ('You cannot rewrite datum. The Interface Pool is read-only. ' );
5454 }
55+
56+ public function getIterator ()
57+ {
58+ return new \ArrayIterator ($ this ->entries );
59+ }
5560}
Original file line number Diff line number Diff line change 66use PHPJava \Kernel \Structures \_MethodInfo ;
77use PHPJava \Utilities \DebugTool ;
88
9- class MethodPool implements \ArrayAccess, \Countable
9+ class MethodPool implements \ArrayAccess, \Countable, \IteratorAggregate
1010{
1111 private $ entries = [];
1212 private $ reader ;
@@ -55,4 +55,9 @@ public function offsetUnset($offset)
5555 {
5656 throw new ReadOnlyException ('You cannot rewrite datum. The Interface Pool is read-only. ' );
5757 }
58+
59+ public function getIterator ()
60+ {
61+ return new \ArrayIterator ($ this ->entries );
62+ }
5863}
Original file line number Diff line number Diff line change 1414use PHPJava \Exceptions \ValidatorException ;
1515use PHPJava \Kernel \Attributes \AttributeInterface ;
1616use PHPJava \Kernel \Attributes \InnerClassesAttribute ;
17+ use PHPJava \Kernel \Attributes \SourceFileAttribute ;
1718use PHPJava \Kernel \Maps \FieldAccessFlag ;
1819use PHPJava \Kernel \Structures \_Utf8 ;
1920use PHPJava \Utilities \ClassResolver ;
@@ -248,11 +249,22 @@ public function __destruct()
248249
249250 public function getClassName (bool $ shortName = false ): string
250251 {
252+ $ className = $ this ->className ->getString ();
251253 if ($ shortName === true ) {
252- $ split = explode ('$ ' , $ this -> className -> getString () );
254+ $ split = explode ('$ ' , $ className );
253255 return $ split [count ($ split ) - 1 ];
254256 }
255- return $ this ->className ->getString ();
257+ return $ className ;
258+ }
259+
260+
261+ public function getPackageName (): ?string
262+ {
263+ $ className = dirname ($ this ->className ->getString ());
264+ if ($ className === '' ) {
265+ return null ;
266+ }
267+ return str_replace ('/ ' , '. ' , $ className );
256268 }
257269
258270 public function getInnerClasses (): array
You can’t perform that action at this time.
0 commit comments