/** * @param Codepoint $codepoint * @return bool * @throws UnexpectedValueException */ private function isPlusOneOfPrevious(Codepoint $codepoint) { if ($this->previous === null) { throw new UnexpectedValueException('Previous cannot be NULL'); } return $this->previous->getValue() + 1 === $codepoint->getValue(); }
/** * @param string $value * @param Codepoint $codepoint * @return string */ protected function parsePlaceholders($value, Codepoint $codepoint) { if ($value === null) { return null; } $hexCodepoint = sprintf('%X', $codepoint->getValue()); return str_replace('#', $hexCodepoint, $value); }
/** * @param Codepoint $start * @param Codepoint $end * @throws InvalidRangeException */ protected function __construct(Codepoint $start, Codepoint $end) { if ($start->getValue() > $end->getValue()) { throw new InvalidRangeException(); } $this->start = $start; $this->end = $end; }
/** * @return int */ public function getCodepointValue() { return $this->codepoint->getValue(); }
/** * @param Codepoint $codepoint * @return string */ private function flattenCodepoint(Codepoint $codepoint) { return sprintf('\\x{%X}', $codepoint->getValue()); }
/** * @param Codepoint $codepoint * @return int */ private function indexFromCodepoint(Codepoint $codepoint) { return $codepoint->getValue(); }
/** * @param Codepoint $codepoint * @return RangeFile * @throws CharacterNotFoundException */ private function getFileByCodepoint(Codepoint $codepoint) { $file = $this->charactersDirectory->getFileFromValue($codepoint->getValue()); if ($file === null) { throw CharacterNotFoundException::withCodepoint($codepoint); } return $file; }