# 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:

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

Package: phing\system\util

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:

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
Version
  $Revision: 1084 $

### Properties

`$slots= 'array()'`
static

Slots that have been registered

Default value `array()`Details

Type

### Methods

`getSlot( string $key ) : \RegisterSlot`
static

Returns 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

Package: phing\system\util

Represents a slot in the register.

### Properties

`$key= ''`

The name of this slot.

Details

Type

`$value= ''`

The value for this slot.

Details

Type

### Methods

`__construct( string $key ) : void`

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 ) : void`

Sets the key / name for this slot.

Parameters

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

`setValue( $v ) : void`

Sets the value for this slot.

Parameters

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

Documentation was generated by DocBlox 0.15.1.