コード例 #1
0
 public function it_parses_bidirectionality_for_bracket_characters()
 {
     $classing = new Classing(Classing::OTHER_NEUTRAL);
     $mirroring = new Mirroring(true, Codepoint::fromInt(41));
     $bracket = Bracket::createOpen(Codepoint::fromInt(41));
     $expected = new BracketBidirectionality($classing, $mirroring, false, $bracket);
     $element = $this->givenTheCharElementFrom(self::XML_BIDI_BRACKET_DATA);
     $this->parseElement($element, Codepoint::fromInt(1))->shouldBeLike($expected);
 }
コード例 #2
0
 /**
  * @return mixed
  */
 protected function parse()
 {
     $class = $this->parseClassing();
     $mirroring = $this->parseMirroring();
     $isControl = $this->getBoolAttribute(self::ATTR_BIDIRECTIONALITY_CONTROL);
     $bracketType = $this->getAttribute(self::ATTR_PAIRED_BRACKET_TYPE);
     if ($bracketType === self::BACKET_TYPE_NONE) {
         return new Bidirectionality($class, $mirroring, $isControl);
     }
     $pairedWith = Codepoint::fromHex($this->getAttribute(self::ATTR_PAIRED_BRACKET));
     $bracket = $bracketType === self::BRACKET_TYPE_OPEN ? Bracket::createOpen($pairedWith) : Bracket::createClose($pairedWith);
     return new BracketBidirectionality($class, $mirroring, $isControl, $bracket);
 }