# classes/phing/system/util/Register.php

Static class to handle a slot-listening system.

Unlike the slots/signals Qt model, this class manages something that is more like a simple hashtable, where each slot has only one value. For that reason "Registers" makes more sense, the reference being to CPU registers.

This could be used for anything, but it's been built for a pretty specific phing need, and that is to allow access to dynamic values that are set by logic that is not represented in a build file. For exampe, we need a system for getting the current resource (file) that is being processed by a filterchain in a fileset.

Each slot corresponds to only one read-only, dynamic-value RegisterSlot object. In a build.xml register slots are expressed using a syntax similar to variables:

<replaceregexp> </replaceregexp>

The task/type must provide a supporting setter for the attribute:

`function setListeningReplace(RegisterSlot $slot) { $this->replace = $slot; }`

// in main() if ($this->replace instanceof RegisterSlot) { $this->regexp->setReplace($this->replace->getValue()); } else { $this->regexp->setReplace($this->replace); }

author
  Hans Lellelid
package
  phing.system.util
version
  $Revision: 1084 $

## \Register
jump to top

Static class to handle a slot-listening system.

Unlike the slots/signals Qt model, this class manages something that is more like a simple hashtable, where each slot has only one value. For that reason "Registers" makes more sense, the reference being to CPU registers.

This could be used for anything, but it's been built for a pretty specific phing need, and that is to allow access to dynamic values that are set by logic that is not represented in a build file. For exampe, we need a system for getting the current resource (file) that is being processed by a filterchain in a fileset.

Each slot corresponds to only one read-only, dynamic-value RegisterSlot object. In a build.xml register slots are expressed using a syntax similar to variables:

<replaceregexp> </replaceregexp>

The task/type must provide a supporting setter for the attribute:

`function setListeningReplace(RegisterSlot $slot) { $this->replace = $slot; }`

// in main() if ($this->replace instanceof RegisterSlot) { $this->regexp->setReplace($this->replace->getValue()); } else { $this->regexp->setReplace($this->replace); }

author
  Hans Lellelid
package
  phing.system.util
version
  $Revision: 1084 $

### Properties

`$slots= 'array'`
static

Slots that have been registered

Default value `array` Details

Type

### Methods

`getSlot( string $key ) : \RegisterSlot`
staticReturns RegisterSlot for specified key.

If not slot exists a new one is created for key.

Parameters

Name | Type | Description
--- | --- | ---
$key | string |

Returns

Type | Description
--- | ---
\RegisterSlot |

## \RegisterSlot
jump to top

Represents a slot in the register.

package
  phing.system.util

### Properties

`$key= ''`

The name of this slot.

Details

Type

`$value= ''`

The value for this slot.

Details

Type

### Methods

`__construct( string $key ) :`
Constructs a new RegisterSlot, setting the key to passed param.
Parameters

Name | Type | Description
--- | --- | ---
$key | string |

`__toString( ) : string`
Returns the value at this slot as a string value.
Returns

Type | Description
--- | ---
string |

`getKey( ) : string`
Gets the key / name for this slot.
Returns

Type | Description
--- | ---
string |

`getValue( ) : mixed`
Returns the value at this slot.
Returns

Type | Description
--- | ---
mixed |

`implodeArray( array $arr ) : string`
Recursively implodes an array to a comma-separated string
Parameters

Name | Type | Description
--- | --- | ---
$arr | array |

Returns

Type | Description
--- | ---
string |

`setKey( string $k ) :`
Sets the key / name for this slot.
Parameters

Name | Type | Description
--- | --- | ---
$k | string |

`setValue( $v ) :`
Sets the value for this slot.
Parameters

Name | Type | Description
--- | --- | ---
$v |  | mixed

Documentation was generated by DocBlox 0.13.1.