protected function parseInput($native, &$pos) { $hasDelimiters = $angleDelimiter = $singleOpen = false; if ('<' === ($char = $this->nextChar($native, $pos)) || '(' === $char) { $hasDelimiters = true; if ('<' === $char) { $angleDelimiter = true; } else { $singleOpen = $pos === call_user_func(self::$strrpos, $native, '('); } $pos++; } $center = $this->point->parseInput($native, $pos); if (')' === $this->nextChar($native, $pos) && $singleOpen) { $hasDelimiters = false; $pos++; } $this->expectChar($native, $pos, ','); $len = strcspn($native, ',)>', $pos); $radius = call_user_func(self::$substr, $native, $pos, $len); $pos += $len; if ($hasDelimiters) { $this->expectChar($native, $pos, $angleDelimiter ? '>' : ')'); } return new Circle($center, $this->_float->input($radius)); }
protected function parseInput($native, &$pos) { $this->expectChar($native, $pos, '{'); $len = strcspn($native, ',}', $pos); $A = call_user_func(self::$substr, $native, $pos, $len); $pos += $len; $this->expectChar($native, $pos, ','); $len = strcspn($native, ',}', $pos); $B = call_user_func(self::$substr, $native, $pos, $len); $pos += $len; $this->expectChar($native, $pos, ','); $len = strcspn($native, ',}', $pos); $C = call_user_func(self::$substr, $native, $pos, $len); $pos += $len; $this->expectChar($native, $pos, '}'); return new Line($this->_float->input($A), $this->_float->input($B), $this->_float->input($C)); }
protected function parseInput($native, &$pos) { $hasDelimiters = false; if ('(' === $this->nextChar($native, $pos)) { $hasDelimiters = true; $pos++; } $len = strcspn($native, ',)', $pos); $x = call_user_func(self::$substr, $native, $pos, $len); $pos += $len; $this->expectChar($native, $pos, ','); $len = strcspn($native, ',)', $pos); $y = call_user_func(self::$substr, $native, $pos, $len); $pos += $len; if ($hasDelimiters) { $this->expectChar($native, $pos, ')'); } return new Point($this->_float->input($x), $this->_float->input($y)); }