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

getAttribute() public method

Returns the stored attribute for the defined $name.
public getAttribute ( string $name ) : null | mixed
$name string Name of the attribute that you wish to return.
return null | mixed Null is returned if attribute doesn't exist, otherwise attribute value is returned.
    public function getAttribute($name)
    {
        return isset($this->attributes[$name]) ? $this->attributes[$name] : null;
    }

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