Webiny\Component\Security\Authentication\Providers\Login::setAttribute PHP Method

setAttribute() public method

Sets an optional attribute into the current instance.
public setAttribute ( string $name, mixed $value )
$name string Attribute name.
$value mixed Attribute value.
    public function setAttribute($name, $value)
    {
        $this->attributes[$name] = $value;
    }

Usage Example

Exemplo n.º 1
0
 public function testGetAttribute()
 {
     $login = new Login('username', 'password', true);
     $login->setAttribute('aname', 'avalue');
     $login->setAttribute('bname', 'bvalue');
     $this->assertSame('avalue', $login->getAttribute('aname'));
     $this->assertSame('bvalue', $login->getAttribute('bname'));
     $login->setAttribute('aname', 'cvalue');
     $this->assertSame('cvalue', $login->getAttribute('aname'));
     $this->assertNull($login->getAttribute('doesnt exist'));
 }
All Usage Examples Of Webiny\Component\Security\Authentication\Providers\Login::setAttribute