Com\Tecnick\Unicode\Bidi\StepN
Tags
Table of Contents
- $brackets : array<string|int, mixed>
- List or bracket pairs positions
- $bstack : array<string|int, mixed>
- Stack used to store bracket positions
- $seq : array<string|int, mixed>
- Sequence to process and return
- __construct() : mixed
- Initialize Sequence to process
- getSequence() : array<string|int, mixed>
- Returns the processed array
- processStep() : mixed
- Generic step
- getBracketPairs() : mixed
- BD16. Find all bracket pairs
- getN0Type() : string
- Return the normalized chat type for the N0 step Within this scope, bidirectional types EN and AN are treated as R.
- getNextN1Char() : int
- Return the index of the next valid char for N1
- process() : mixed
- Process N steps Resolving Neutral and Isolate Formatting Types
- processInsideBrackets() : bool
- Inspect the bidirectional types of the characters enclosed within the bracket pair.
- processN0() : mixed
- N0. Process bracket pairs in an isolating run sequence sequentially in the logical order of the text positions of the opening paired brackets.
- processN1() : mixed
- N1. A sequence of NIs takes the direction of the surrounding strong text if the text on both sides has the same direction. European and Arabic numbers act as if they were R in terms of their influence on NIs.
- processN1next() : string
- Get the next direction
- processN1prev() : string
- Get the next direction
- processN2() : mixed
- N2. Any remaining NIs take the embedding direction.
- setBracketsType() : bool
- Set the brackets type
Properties
$brackets
List or bracket pairs positions
protected array<string|int,
mixed> $brackets = array()
$bstack
Stack used to store bracket positions
protected array<string|int,
mixed> $bstack = array()
$seq
Sequence to process and return
protected array<string|int,
mixed> $seq = array()
Methods
__construct()
Initialize Sequence to process
public __construct(array<string|int,
mixed> $seq[,
bool $process
= true
]) : mixed
Parameters
- $seq : array<string|int, mixed>
-
Isolated Sequence array
- $process : bool = true
-
If false disable automatic processing (this is a testing flag)
Return values
mixed —getSequence()
Returns the processed array
public getSequence()
: array<string|int,
mixed>
Return values
array<string|int, mixed> —processStep()
Generic step
public processStep(string $method)
: mixed
Parameters
- $method : string
-
Processing methos
Return values
mixed —getBracketPairs()
BD16. Find all bracket pairs
protected getBracketPairs(mixed $idx)
: mixed
Parameters
- $idx : mixed
Return values
mixed —getN0Type()
Return the normalized chat type for the N0 step Within this scope, bidirectional types EN and AN are treated as R.
protected getN0Type(string $type)
: string
Parameters
- $type : string
-
Char type
Return values
string —getNextN1Char()
Return the index of the next valid char for N1
protected getNextN1Char(int $idx)
: int
Parameters
- $idx : int
-
Start index
Return values
int —process()
Process N steps Resolving Neutral and Isolate Formatting Types
protected process()
: mixed
Neutral and isolate formatting (i.e. NI) characters are resolved one isolating run sequence at a time. Its results are that all NIs become either R or L. Generally, NIs take on the direction of the surrounding text. In case of a conflict, they take on the embedding direction. At isolating run sequence boundaries where the type of the character on the other side of the boundary is required, the type assigned to sos or eos is used.
Bracket pairs within an isolating run sequence are processed as units so that both the opening and the closing paired bracket in a pair resolve to the same direction. Note that this rule is applied based on the current bidirectional character type of each paired bracket and not the original type, as this could have changed under X6. The current bidirectional character type may also have changed under a previous iteration of the for loop in N0 in the case of nested bracket pairs.
Return values
mixed —processInsideBrackets()
Inspect the bidirectional types of the characters enclosed within the bracket pair.
protected processInsideBrackets(int $open,
int $close,
string $odir)
: bool
Parameters
- $open : int
-
Open bracket entry
- $close : int
-
Close bracket entry
- $odir : string
-
Opposite direction (L or R)
Return values
bool —True if type has not been found
processN0()
N0. Process bracket pairs in an isolating run sequence sequentially in the logical order of the text positions of the opening paired brackets.
protected processN0()
: mixed
Return values
mixed —processN1()
N1. A sequence of NIs takes the direction of the surrounding strong text if the text on both sides has the same direction. European and Arabic numbers act as if they were R in terms of their influence on NIs.
protected processN1(int $idx)
: mixed
The start-of-sequence (sos) and end-of-sequence (eos) types are used at isolating run sequence boundaries.
Parameters
- $idx : int
-
Current character position
Return values
mixed —processN1next()
Get the next direction
protected processN1next(int &$jdx)
: string
Parameters
- $jdx : int
-
Position of the next character
Return values
string —Previous position
processN1prev()
Get the next direction
protected processN1prev(int &$bdx)
: string
Parameters
- $bdx : int
-
Position of the preceding character
Return values
string —Previous position
processN2()
N2. Any remaining NIs take the embedding direction.
protected processN2(int $idx)
: mixed
Parameters
- $idx : int
-
Current character position
Return values
mixed —setBracketsType()
Set the brackets type
protected setBracketsType(int $open,
int $close,
string $type)
: bool
Parameters
- $open : int
-
Open bracket entry
- $close : int
-
Close bracket entry
- $type : string
-
Type
Return values
bool —True if type has not been found