Znerol\Component\Stringprep\Profile::checkbidi PHP Method

checkbidi() protected method

* If a string contains any RandALCat character (Table D.1), the string MUST NOT contain any LCat (Table D.2) character. * If a string contains any RandALCat character, a RandALCat character MUST be the first character of the string, and a RandALCat character MUST be the last character of the string.
protected checkbidi ( $codepoints )
    protected function checkbidi($codepoints)
    {
        if (!count($codepoints)) {
            return;
        }
        $RALmode = !RFC3454\D_1::filter(reset($codepoints));
        if ($RALmode) {
            if (RFC3454\D_1::filter($codepoints[count($codepoints) - 1])) {
                throw new ProfileException('Invalid bidirectional text');
            }
            // Ensure that there are'nt any L characters in this string.
            array_walk($codepoints, 'static::validateCodepoint', 'Znerol\\Component\\Stringprep\\RFC3454\\D_2::filter');
        } else {
            // Ensure that there are'nt any R/AL characters in this string.
            array_walk($codepoints, 'static::validateCodepoint', 'Znerol\\Component\\Stringprep\\RFC3454\\D_1::filter');
        }
    }