/**
  * {@inheritDoc}
  */
 public function getByCodepoint(Codepoint $codepoint)
 {
     $index = $this->indexFromCodepoint($codepoint);
     if (array_key_exists($index, $this->characters) === false) {
         throw CharacterNotFoundException::withCodepoint($codepoint);
     }
     return $this->characters[$index];
 }
Beispiel #2
0
 /**
  * @param Codepoint $codepoint
  * @return Character
  * @throws CharacterNotFoundException
  */
 public function getCharacterByCodepoint(Codepoint $codepoint)
 {
     $assigned = $this->getByCodepoint($codepoint);
     if ($assigned instanceof Character) {
         return $assigned;
     }
     throw CharacterNotFoundException::withCodepoint($codepoint);
 }
 /**
  * @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);
 }
Beispiel #4
0
 /**
  * {@inheritDoc}
  */
 public function getByCodepoint(Codepoint $codepoint)
 {
     throw CharacterNotFoundException::withCodepoint($codepoint);
 }
Beispiel #5
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;
 }