public function setAttribute($key, $value)
    {

        // query whether or not the key has already been used
        if (isset($this->attributes[$key])) {
            throw new \Exception(sprintf('Try to override data with key %s', $key));
        }

        // set the attribute in the registry
        $this->attributes[$key] = $value;
    }
public function setAttribute($key, $value)
    {

        // query whether or not the key has already been used
        if (isset($this->attributes[$key])) {
            throw new \Exception(sprintf('Try to override data with key %s', $key));
        }

        // set the attribute in the registry
        $this->attributes[$key] = $value;
    }
public function setAttribute ( $ key , $ value ) { // query whether or not the key has already been used if ( isset ( $ this -> attributes [ $ key ] ) ) { throw new \ Exception ( sprintf ( 'Try to override data with key %s' , $ key ) ) ; } // set the attribute in the registry $ this -> attributes [ $ key ] = $ value ; }
Register the passed attribute under the specified key in the registry.

@param mixed $key   The key to register the value with
@param mixed $value The value to be registered

@return void
@throws \Exception Is thrown, if the key has already been used
Register the passed attribute under the specified key in the registry .