id); return (string)end($parts); } public function isAdmin(): bool { return $this->admin === 1 || $this->admin === 2; } /** "Toto, 25 ans, F, Lyon" — the profile line of the lists' tooltip. */ public function profile(): string { $bits = []; if ($this->age > 0) { $bits[] = $this->age . ' ' . \JumPHP\Util\Lang::t('y.o.'); } if ($this->isAdmin()) { $bits[] = \JumPHP\Util\Lang::t('moderator'); } elseif ($this->sex === 0 || $this->sex === 1) { $bits[] = $this->sex === 0 ? \JumPHP\Util\Lang::t('woman') : \JumPHP\Util\Lang::t('man'); } if ($this->city !== '') { $bits[] = $this->city; } return $this->nickname . ($bits === [] ? '' : ' — ' . implode(', ', $bits)); } public function with(?string $nickname = null): self { return new self($this->id, $nickname ?? $this->nickname, $this->age, $this->sex, $this->city, $this->admin, $this->where, $this->state); } }