Пример #1
0
 /**
  * @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();
 }
Пример #2
0
 /**
  * @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);
 }
Пример #3
0
 /**
  * @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;
 }
Пример #4
0
 /**
  * @return int
  */
 public function getCodepointValue()
 {
     return $this->codepoint->getValue();
 }
Пример #5
0
 /**
  * @param Codepoint $codepoint
  * @return string
  */
 private function flattenCodepoint(Codepoint $codepoint)
 {
     return sprintf('\\x{%X}', $codepoint->getValue());
 }
Пример #6
0
 /**
  * @param Codepoint $codepoint
  * @return int
  */
 private function indexFromCodepoint(Codepoint $codepoint)
 {
     return $codepoint->getValue();
 }
Пример #7
0
 /**
  * @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;
 }