### php.java.bridge

# Class PhpMap

- `java.lang.Object`

- `php.java.bridge.PhpMap`

`public abstract class PhpMap`
`extends java.lang.Object`

Maps php array get/set and foreach to java array, Map and Collections access.

Author:
  jostb

## Method Summary

`java.lang.Object`

`currentData()`
  Returns the object at the current position.

`php.java.bridge.Request.PhpString`

`currentKey()`
  Returns the key at the current position.

`static PhpMap`

`getPhpMap(java.lang.Object value, JavaBridge bridge)`
  Returns a PhpMap for a given value.

`boolean`

`getType()`
  Returns the key type.

`boolean`

`hasMore()`
  Checks if it is possible to advance one element

`boolean`

`moveForward()`
  Forward one element.

`boolean`

`offsetExists(java.lang.Object pos)`
  Checks if a given position exists.

`java.lang.Object`

`offsetGet(java.lang.Object pos)`
  Returns the object at the posisition.

`void`

`offsetSet(java.lang.Object pos, java.lang.Object val)`
  Set an object at position.

`void`

`offsetUnset(java.lang.Object pos)`
  Remove an object from the position.

### Methods inherited from class java.lang.Object

`equals`, `getClass`, `hashCode`, `notify`, `notifyAll`, `toString`, `wait`, `wait`, `wait`

## Method Details

### currentData

    public java.lang.Object currentData()

> Returns the object at the current position.

> Returns:
>   The current object.

### currentKey

    public php.java.bridge.Request.PhpString currentKey()

> Returns the key at the current position.

> Returns:
>   The current key.

### getPhpMap

    public static PhpMap getPhpMap(java.lang.Object value,
                                   JavaBridge bridge)

> Returns a PhpMap for a given value.

> Parameters:
>   `value` - The value, must be an array or implement Map or Collection
>   `bridge` - The bridge instance

> Returns:
>   The PhpMap

### getType

    public boolean getType()

> Returns the key type.

> Returns:
>   false if key is integer (array index), true if key is string (hash key)

### hasMore

    public boolean hasMore()

> Checks if it is possible to advance one element

> Returns:
>   true if next element exists, false otherwise

### moveForward

    public boolean moveForward()

> Forward one element.

> Returns:
>   true if move was possible, false otherwise.

### offsetExists

    public boolean offsetExists(java.lang.Object pos)

> Checks if a given position exists. Use one of the methods from JavaBridge instead.

> Parameters:
>   `pos` - The position

> Returns:
>   true if an element exists at this position, false otherwise.

> See Also:
>   `JavaBridge.offsetExists(Object[],Object)`, `JavaBridge.offsetExists(Map,Object)`

### offsetGet

    public java.lang.Object offsetGet(java.lang.Object pos)

> Returns the object at the posisition. Use one of the methods from JavaBridge instead.

> Parameters:
>   `pos` - The position.

> Returns:
>   The object at the given position.

> See Also:
>   `JavaBridge.offsetGet(Object[],Object)`, `JavaBridge.offsetGet(Map,Object)`

### offsetSet

    public void offsetSet(java.lang.Object pos,
                          java.lang.Object val)

> Set an object at position. Use one of the methods from JavaBridge instead.

> Parameters:
>   `pos` - The position.
>   `val` - The object.

> See Also:
>   `JavaBridge.offsetSet(Object[],Object,Object)`, `JavaBridge.offsetSet(Map,Object,Object)`

### offsetUnset

    public void offsetUnset(java.lang.Object pos)

> Remove an object from the position. Use one of the methods from JavaBridge instead.

> Parameters:
>   `pos` - The position.

> See Also:
>   `JavaBridge.offsetUnset(Object[],Object)`, `JavaBridge.offsetUnset(Map,Object)`