PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 3.1.0
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v3.1.0
3.3.1 V-3.3.0 3.2.2 3.2.1 3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 V3.0.3 V3.0.2 -3.0.1 V_3.0.0 1.1.1 1.1.8 1.2 1.3 1.4 1.4.18 1.5.2 1.9 2.0 2.10.0 2.10.1 All 138 releases
bit-form / vendor / arif-un / jcof / src / StringReader.php

StringReader.php in Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder 3.1.0, at vendor/arif-un/jcof/src/StringReader.php

53 lines 919 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace BitCode\BitForm\Jcof;
4
5 class StringReader
6 {
7 public $str;
8
9 public $index;
10
11 public function __construct($str)
12 {
13 $this->str = $str;
14 $this->index = 0;
15 }
16
17 public function peek()
18 {
19 if ($this->index >= strlen($this->str)) {
20 return null;
21 } else {
22 return substr($this->str, $this->index, 1);
23 }
24 }
25
26 public function consume()
27 {
28 $this->index += 1;
29 }
30
31 public function skip($ch)
32 {
33 $peeked = $this->peek();
34 if ($peeked != $ch) {
35 $this->error("Unexpected char: Expected '".$ch."', got '".$peeked."'");
36 }
37
38 $this->consume();
39 }
40
41 public function maybeSkip($ch)
42 {
43 if ($this->peek() == $ch) {
44 $this->consume();
45 }
46 }
47
48 public function error($msg)
49 {
50 throw new ParseErrors($msg, $this->index);
51 }
52 }
53