@@ -26,7 +26,7 @@ public function parse($content)
26
26
{
27
27
$ this ->cursor = 0 ;
28
28
$ this ->content = $ content ;
29
- $ this ->length = StringHelper:: strlen ($ this ->content );
29
+ $ this ->length = strlen ($ this ->content );
30
30
31
31
$ this ->doParse ();
32
32
}
@@ -38,16 +38,16 @@ protected function isFinished()
38
38
39
39
protected function consumeAll ()
40
40
{
41
- $ rest = StringHelper:: substr ($ this ->content , $ this ->cursor );
42
- $ this ->cursor += StringHelper:: strlen ($ rest );
41
+ $ rest = substr ($ this ->content , $ this ->cursor );
42
+ $ this ->cursor += strlen ($ rest );
43
43
44
44
return $ rest ;
45
45
}
46
46
47
47
protected function expects ($ expected )
48
48
{
49
- $ length = StringHelper:: strlen ($ expected );
50
- $ actual = StringHelper:: substr ($ this ->content , $ this ->cursor , $ length );
49
+ $ length = strlen ($ expected );
50
+ $ actual = substr ($ this ->content , $ this ->cursor , $ length );
51
51
if ($ actual !== $ expected ) {
52
52
return false ;
53
53
}
@@ -60,18 +60,18 @@ protected function expects($expected)
60
60
protected function consumeShortHash ()
61
61
{
62
62
if (!preg_match ('/([A-Za-z0-9]{7,40})/A ' , $ this ->content , $ vars , null , $ this ->cursor )) {
63
- throw new \RuntimeException ('No short hash found: ' .StringHelper:: substr ($ this ->content , $ this ->cursor , 7 ));
63
+ throw new \RuntimeException ('No short hash found: ' .substr ($ this ->content , $ this ->cursor , 7 ));
64
64
}
65
65
66
- $ this ->cursor += StringHelper:: strlen ($ vars [1 ]);
66
+ $ this ->cursor += strlen ($ vars [1 ]);
67
67
68
68
return $ vars [1 ];
69
69
}
70
70
71
71
protected function consumeHash ()
72
72
{
73
73
if (!preg_match ('/([A-Za-z0-9]{40})/A ' , $ this ->content , $ vars , null , $ this ->cursor )) {
74
- throw new \RuntimeException ('No hash found: ' .StringHelper:: substr ($ this ->content , $ this ->cursor , 40 ));
74
+ throw new \RuntimeException ('No hash found: ' .substr ($ this ->content , $ this ->cursor , 40 ));
75
75
}
76
76
77
77
$ this ->cursor += 40 ;
@@ -85,29 +85,29 @@ protected function consumeRegexp($regexp)
85
85
throw new \RuntimeException ('No match for regexp ' .$ regexp );
86
86
}
87
87
88
- $ this ->cursor += StringHelper:: strlen ($ vars [0 ]);
88
+ $ this ->cursor += strlen ($ vars [0 ]);
89
89
90
90
return $ vars ;
91
91
}
92
92
93
93
protected function consumeTo ($ text )
94
94
{
95
- $ pos = StringHelper:: strpos ($ this ->content , $ text , $ this ->cursor );
95
+ $ pos = strpos ($ this ->content , $ text , $ this ->cursor );
96
96
97
97
if (false === $ pos ) {
98
98
throw new \RuntimeException (sprintf ('Unable to find "%s" ' , $ text ));
99
99
}
100
100
101
- $ result = StringHelper:: substr ($ this ->content , $ this ->cursor , $ pos - $ this ->cursor );
101
+ $ result = substr ($ this ->content , $ this ->cursor , $ pos - $ this ->cursor );
102
102
$ this ->cursor = $ pos ;
103
103
104
104
return $ result ;
105
105
}
106
106
107
107
protected function consume ($ expected )
108
108
{
109
- $ length = StringHelper:: strlen ($ expected );
110
- $ actual = StringHelper:: substr ($ this ->content , $ this ->cursor , $ length );
109
+ $ length = strlen ($ expected );
110
+ $ actual = substr ($ this ->content , $ this ->cursor , $ length );
111
111
if ($ actual !== $ expected ) {
112
112
throw new \RuntimeException (sprintf ('Expected "%s", but got "%s" (%s) ' , $ expected , $ actual , substr ($ this ->content , $ this ->cursor , 10 )));
113
113
}
0 commit comments