public function set(&$variable, $identifier = null)
    {
        // Generate identifier if not passed
        if (null === $identifier) {
            $identifier = sha1(serialize($variable));
        }

        // store the variable as reference
        self::$references[]          = $variable;
        $index                       = count(self::$references) - 1;
        self::$lookup[$identifier]   = $index;
        self::$reverseLookup[$index] = $identifier;

        // store count of elements
        self::$count = $index + 1;

        // return identifier for outer use
        return $identifier;
    }
public function set(&$variable, $identifier = null)
    {
        // Generate identifier if not passed
        if (null === $identifier) {
            $identifier = sha1(serialize($variable));
        }

        // store the variable as reference
        self::$references[]          = $variable;
        $index                       = count(self::$references) - 1;
        self::$lookup[$identifier]   = $index;
        self::$reverseLookup[$index] = $identifier;

        // store count of elements
        self::$count = $index + 1;

        // return identifier for outer use
        return $identifier;
    }
public function set ( & $ variable , $ identifier = null ) { // Generate identifier if not passed if ( null === $ identifier ) { $ identifier = sha1 ( serialize ( $ variable ) ) ; } // store the variable as reference self :: $ references [ ] = $ variable ; $ index = count ( self :: $ references ) - 1 ; self :: $ lookup [ $ identifier ] = $ index ; self :: $ reverseLookup [ $ index ] = $ identifier ; // store count of elements self :: $ count = $ index + 1 ; // return identifier for outer use return $ identifier ; }
This method storages an element in the registry under the passed key.

@param string $variable   The variable (class, object) to store
@param string $identifier The identifier for the stored object, class ...
If not passed a UUID is calculated and returned

@author Benjamin Carl <opensource@clickalicious.de>

@return string The identifier for reading the stored variable
This method storages an element in the registry under the passed key .