TranscodeStep::create($string_type), self::STEP_MAP => MapStep::create(), self::STEP_NORMALIZE => new NormalizeStep(), self::STEP_PROHIBIT => new ProhibitStep(), self::STEP_CHECK_BIDI => new CheckBidiStep(), // @todo Vary by string type self::STEP_INSIGNIFICANT_CHARS => new InsignificantNonSubstringSpaceStep(), ]; return new self($steps); } /** * Get self with case folding set. * * @param bool $fold True to apply case folding */ public function withCaseFolding(bool $fold): self { $obj = clone $this; $obj->_steps[self::STEP_MAP] = MapStep::create($fold); return $obj; } /** * Prepare string. */ public function prepare(string $string): string { foreach ($this->_steps as $step) { $string = $step->apply($string); } return $string; } }