Skip to content

Commit

Permalink
[skip ci] Fix a few style nits
Browse files Browse the repository at this point in the history
  • Loading branch information
TRowbotham committed Jun 10, 2020
1 parent cd637a4 commit b2dc8f9
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/CodePointString.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
class CodePointString extends PunycodeCodePointString
{
protected const RESOURCE_DIR = __DIR__ . DS . '..' . DS . 'resources';
protected const NO = 0;
protected const YES = 1;

protected const NO = 0;
protected const YES = 1;
protected const MAYBE = -1;

/**
Expand All @@ -40,15 +41,6 @@ public function codePointAt(int $index): ?int
return $this->codePoints[$index] ?? null;
}

public function maybeNormalize(): string
{
if ($this->quickCheckNFC() === self::YES) {
return $this->input;
}

return Normalizer::normalize($this->input, Normalizer::FORM_C);
}

public function isNormalized(): bool
{
$result = $this->quickCheckNFC();
Expand All @@ -64,6 +56,15 @@ public function isNormalized(): bool
return $this->input === Normalizer::normalize($this->input, Normalizer::FORM_C);
}

public function maybeNormalize(): string
{
if ($this->quickCheckNFC() === self::YES) {
return $this->input;
}

return Normalizer::normalize($this->input, Normalizer::FORM_C);
}

/**
* @see https://www.unicode.org/reports/tr15/#Detecting_Normalization_Forms
*/
Expand Down

0 comments on commit b2dc8f9

Please sign in to comment.