AppserverIo\Appserver\Core\Traits\ThreadedContextTrait::setAttribute PHP Method

setAttribute() public method

Sets the passed key/value pair in the directory.
public setAttribute ( string $key, mixed $value ) : void
$key string The attributes key
$value mixed Tha attribute to be bound
return void
    public function setAttribute($key, $value)
    {
        // if the value is already set, throw an exception
        if (isset($this[$uid = $this->maskKey($key)])) {
            throw new \Exception(sprintf('A value with key %s has already been set in application %s', $key, $this->getName()));
        }
        // append the value to the application
        $this[$uid] = $value;
    }