/** * @param mixed $other * @return bool */ public function equals($other) { if ($this === $other) { return true; } return $other instanceof self && $this->codepoint->equals($other->codepoint); }
/** * @param Codepoint $codepoint * @return bool */ public function has(Codepoint $codepoint) { foreach ($this as $check) { if ($codepoint->equals($check)) { return true; } } return false; }
/** * @param Codepoint $codepoint * @throws CharacterNotFoundException * @return CodepointAssigned */ public function getByCodepoint(Codepoint $codepoint) { foreach ($this->getAll() as $character) { if ($codepoint->equals($character->getCodepoint())) { return $character; } } throw CharacterNotFoundException::withCodepoint($codepoint); }
/** * @return bool */ public function representsSingleCodepoint() { return $this->start->equals($this->end); }