/** * Set the name for this connection * * @param string $name * @return void */ public function setName($name) { if ($name === "") { return; } // Check if the name exists already if ($this->repository->getClientByName($name) !== null) { $this->send(['action' => 'setname', 'success' => false, 'username' => $this->name]); return; } $this->name = $name; $this->send(['action' => 'setname', 'success' => true, 'username' => $this->name]); }
/** * Set the name for this connection * * @param string $name * @return void */ public function setName($name) { if ($name === "") { return; } echo ' entering setName ChatConnection via ChatConnectionInterface'; // Check if the name exists already if ($this->repository->getClientByName($name) !== null) { echo ' name exists: ' . $name; $this->send(['action' => 'setname', 'success' => false, 'username' => $this->name]); return; } $this->name = $name; echo 'this-> name set to: ' . $name; $this->send(['action' => 'setname', 'success' => true, 'username' => $this->name]); }