Thruway\Peer\Client::addRole PHP Method

addRole() public method

Add role
public addRole ( AbstractRole $role ) : Client
$role Thruway\Role\AbstractRole
return Client
    public function addRole(AbstractRole $role)
    {
        if ($role instanceof Publisher) {
            $this->publisher = $role;
        } elseif ($role instanceof Subscriber) {
            $this->subscriber = $role;
        } elseif ($role instanceof Callee) {
            $this->callee = $role;
        } elseif ($role instanceof Caller) {
            $this->caller = $role;
        }
        array_push($this->roles, $role);
        return $this;
    }