All checks were successful
The build was successful.
In most (all?) modern OOP languages class members visibility is assumed to be private and programmer has to consciously set it to public or protected. PHP has the different approach what can cause a security flaws in written scripts. AerScript will not follow this way, as it seems to be conceptually broken.
37 lines
695 B
Plaintext
37 lines
695 B
Plaintext
class StringTokenizer {
|
|
private string $token;
|
|
private string $delim;
|
|
|
|
public void __construct(string $str, string $delim = ' ') {
|
|
$this->token = strtok($str, $delim);
|
|
$this->delim = $delim;
|
|
}
|
|
|
|
public void __destruct() {
|
|
unset($this);
|
|
}
|
|
|
|
public bool hasMoreTokens() {
|
|
return ($this->token != NULL);
|
|
}
|
|
|
|
public string nextToken() {
|
|
string $current = $this->token;
|
|
$this->token = strtok($this->delim);
|
|
return $current;
|
|
}
|
|
|
|
}
|
|
|
|
class Program {
|
|
public void main() {
|
|
string $str = "This is:@\t\n a TEST!";
|
|
string $delim = " !@:\t\n";
|
|
object $st = new StringTokenizer($str, $delim);
|
|
while ($st->hasMoreTokens()) {
|
|
print($st->nextToken(), "\n");
|
|
}
|
|
unset($st);
|
|
}
|
|
}
|