Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AbstractTokenizer.php
Go to the documentation of this file.
1 <?php
7 
11 abstract class AbstractTokenizer
12 {
18  protected $_currentIndex;
19 
25  protected $_string;
26 
34  public function next()
35  {
36  if ($this->_currentIndex + 1 >= strlen($this->_string)) {
37  return false;
38  }
39 
40  $this->_currentIndex++;
41  return true;
42  }
43 
51  public function prev()
52  {
53  if ($this->_currentIndex - 1 < 0) {
54  return false;
55  }
56 
57  $this->_currentIndex--;
58  return true;
59  }
60 
69  public function back($distance)
70  {
71  if ($this->_currentIndex - $distance < 0) {
72  return false;
73  }
74 
75  $this->_currentIndex -= $distance;
76  return true;
77  }
78 
84  public function char()
85  {
86  return $this->_string[$this->_currentIndex];
87  }
88 
95  public function setString($value)
96  {
97  $this->_string = urldecode($value);
98  $this->reset();
99  }
100 
106  public function reset()
107  {
108  $this->_currentIndex = 0;
109  }
110 
116  public function isWhiteSpace()
117  {
118  return trim($this->char()) != $this->char();
119  }
120 
126  abstract public function tokenize();
127 }
$value
Definition: gender.phtml:16