PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 3.3.1
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v3.3.1
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 / StringWriter.php

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

48 lines 998 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 StringWriter
6 {
7 public $str;
8
9 public $maybeNextSep;
10
11 public $prevCh;
12
13 public function __construct()
14 {
15 $this->str = '';
16 $this->maybeNextSep = null;
17 $this->prevCh = null;
18 }
19
20 public function write($s)
21 {
22 if ($this->maybeNextSep) {
23 if (! $this->isSep($this->prevCh) && ! $this->isSep(substr($s, 0, 1))) {
24 $this->str .= $this->maybeNextSep;
25 }
26 $this->maybeNextSep = null;
27 }
28
29 $this->str .= $s;
30 $this->prevCh = substr($s, strlen($s) - 1, 1);
31 }
32
33 public function maybeSep($sep)
34 {
35 if ($this->maybeNextSep) {
36 $this->write($this->maybeNextSep);
37 }
38
39 $this->maybeNextSep = $sep;
40 }
41
42 public function isSep($ch)
43 {
44 return $ch == '[' || $ch == ']' || $ch == '{' || $ch == '}' ||
45 $ch == '(' || $ch == ')' || $ch == ',' || $ch == ':' || $ch == '"';
46 }
47 }
48